|
46330
|
1655
|
10
|
2026-05-15T06:59:55.624179+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-15/1778 /Users/lukas/.screenpipe/data/data/2026-05-15/1778828395624_m2.jpg...
|
Firefox
|
Pipelines - jiminny/app — Work
|
1
|
app.circleci.com/pipelines/github/jiminny/app
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 4 Q2 - Platform Team - Scrum Board Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20904 Fix UpdateActivityElasticSearchDocumentCommand find activity… by LakyLak · Pull Request #12078 · jiminny/app
JY-20904 Fix UpdateActivityElasticSearchDocumentCommand find activity… by LakyLak · Pull Request #12078 · jiminny/app
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20891 add support for secondary email by LakyLak · Pull Request #12073 · jiminny/app
JY-20891 add support for secondary email by LakyLak · Pull Request #12073 · jiminny/app
[SRD-6853] Moxso - Potential deal stages bug - Jira
[SRD-6853] Moxso - Potential deal stages bug - Jira
Service-Desk - Queues - Platform team - Service space - Jira
Service-Desk - Queues - Platform team - Service space - Jira
Pipelines - jiminny/app
Pipelines - jiminny/app
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Go to home page
Auto theme
Open notifications
Open support menu
Open user menu
org avatar Current organization: jiminny
Home
Home
Pipelines
Pipelines
Projects
Projects
Deploys
Deploys
Insights
Insights
Runners
Runners
Org
Org
Plan
Plan
Chunk sidecars
Chunk sidecars
PREVIEW
Chunk
Chunk
Dashboard All Pipelines
All Pipelines
Project Outline app
app
app
app
Overview
Overview
Settings
Settings
Deploys
Deploys
Lightning Manage triggers
Manage triggers
Trigger Pipeline
Pipelines All pipelines my-pipelines-filter
All pipelines
app Project Filter. Selected "app"
app
All branches Branch Filter. Selected "All branches"
All branches
Start Time Cutoff date Arrow Drop Down
Cutoff date
All statuses Arrow Drop Down
All
statuses
Filter Display options
Display options
Pipeline
Status
Workflow
Checkout source
Trigger event
Start
Duration
Actions
app
58412
58412
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
12m 17s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20904-fix-update-es-on-activity-command
JY-20904-fix-update-es-on-activity-command
Open commit on version control site
c70ef5a
Merge branch 'master' into JY-20904-fix-update-es-on-activity-command
Push
Commit pushed
Copy timestamp to clipboard
13m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Rerun workflow from failed
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
887470
2m 16s
2m 16s
SUCCESS job build-frontend
build-frontend
887471
1m 16s
1m 16s
SUCCESS job test-frontend
test-frontend
887472
1m 31s
1m 31s
SUCCESS job build-backend
build-backend
887473
51s
51s
SUCCESS job phpstan
phpstan
887477
1m 21s
1m 21s
SUCCESS job setup
setup
887475
57s
57s
RUNNING job test
test
887476
8m 2s
8m 2s
SUCCESS job test-backend-lint
test-backend-lint
887474
4m 13s
4m 13s
sonar_cloud
887478
SUCCESS workflow setup-workflow. Collapse the workflow jobs list.
Status Passed Success
Success
setup-workflow
setup-workflow
SETUP
JY-20904-fix-update-es-on-activity-command
JY-20904-fix-update-es-on-activity-command
Open commit on version control site
c70ef5a
Merge branch 'master' into JY-20904-fix-update-es-on-activity-command
Push
Commit pushed
Copy timestamp to clipboard
13m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Rerun workflow from failed
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job setup
setup
887469
30s
30s
app
58411
58411
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
7m 21s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20891-improve-sms-text-relays
JY-20891-improve-sms-text-relays
Open commit on version control site
772eb11
Merge branch 'master' into JY-20891-improve-sms-text-relays
Push
Commit pushed
Copy timestamp to clipboard
18m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Rerun workflow from failed
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
887460
1m 13s
1m 13s
SUCCESS job build-frontend
build-frontend
887461
1m 20s
1m 20s
SUCCESS job test-frontend
test-frontend
887462
1m 51s...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.25,"top":0.0518755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.2632979,"top":0.06304868,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app","depth":4,"bounds":{"left":0.25,"top":0.08459697,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app","depth":5,"bounds":{"left":0.2632979,"top":0.09577015,"width":0.18932846,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20904 Fix UpdateActivityElasticSearchDocumentCommand find activity… by LakyLak · Pull Request #12078 · jiminny/app","depth":4,"bounds":{"left":0.25,"top":0.11731844,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20904 Fix UpdateActivityElasticSearchDocumentCommand find activity… by LakyLak · Pull Request #12078 · jiminny/app","depth":5,"bounds":{"left":0.2632979,"top":0.12849163,"width":0.21575798,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app","depth":4,"bounds":{"left":0.25,"top":0.15003991,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app","depth":5,"bounds":{"left":0.2632979,"top":0.16121309,"width":0.18932846,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20891 add support for secondary email by LakyLak · Pull Request #12073 · jiminny/app","depth":4,"bounds":{"left":0.25,"top":0.18276137,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20891 add support for secondary email by LakyLak · Pull Request #12073 · jiminny/app","depth":5,"bounds":{"left":0.2632979,"top":0.19393456,"width":0.15658244,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6853] Moxso - Potential deal stages bug - Jira","depth":4,"bounds":{"left":0.25,"top":0.21548285,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6853] Moxso - Potential deal stages bug - Jira","depth":5,"bounds":{"left":0.2632979,"top":0.22665602,"width":0.09158909,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":4,"bounds":{"left":0.25,"top":0.2482043,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":5,"bounds":{"left":0.2632979,"top":0.25937748,"width":0.10721409,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.25,"top":0.28092578,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.2632979,"top":0.29209897,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.31732047,"top":0.28810853,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.2528258,"top":0.31524342,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.2528258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.26379654,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.27493352,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.28607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.29720744,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Go to home page","depth":9,"bounds":{"left":0.33726728,"top":0.061452515,"width":0.044215426,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Auto theme","depth":9,"bounds":{"left":0.9375,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open notifications","depth":9,"bounds":{"left":0.95212764,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Open support menu","depth":9,"bounds":{"left":0.96675533,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Open user menu","depth":9,"bounds":{"left":0.98138297,"top":0.061452515,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"org avatar Current organization: jiminny","depth":9,"bounds":{"left":0.33693483,"top":0.10295291,"width":0.01462766,"height":0.035115723},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Home","depth":10,"bounds":{"left":0.33494017,"top":0.15083799,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Home","depth":12,"bounds":{"left":0.33776596,"top":0.1839585,"width":0.012965426,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Pipelines","depth":10,"bounds":{"left":0.33494017,"top":0.21308859,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines","depth":12,"bounds":{"left":0.33394283,"top":0.2462091,"width":0.020611702,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Projects","depth":10,"bounds":{"left":0.33494017,"top":0.2753392,"width":0.01861702,"height":0.04668795},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Projects","depth":12,"bounds":{"left":0.3352726,"top":0.3084597,"width":0.017952127,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Deploys","depth":10,"bounds":{"left":0.33494017,"top":0.33798882,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Deploys","depth":12,"bounds":{"left":0.33543882,"top":0.37071028,"width":0.01761968,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Insights","depth":10,"bounds":{"left":0.33494017,"top":0.40023944,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Insights","depth":12,"bounds":{"left":0.33560506,"top":0.4329609,"width":0.017287234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Runners","depth":10,"bounds":{"left":0.33494017,"top":0.46249002,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Runners","depth":12,"bounds":{"left":0.3352726,"top":0.49561054,"width":0.017952127,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Org","depth":10,"bounds":{"left":0.33494017,"top":0.52474064,"width":0.01861702,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Org","depth":12,"bounds":{"left":0.3402593,"top":0.55786115,"width":0.007978723,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Plan","depth":10,"bounds":{"left":0.33494017,"top":0.58699125,"width":0.01861702,"height":0.04668795},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Plan","depth":12,"bounds":{"left":0.33959442,"top":0.6201117,"width":0.00930851,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chunk sidecars","depth":11,"bounds":{"left":0.32962102,"top":0.8591381,"width":0.02925532,"height":0.059457302},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Chunk sidecars","depth":13,"bounds":{"left":0.33494017,"top":0.8922586,"width":0.01861702,"height":0.026735835},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PREVIEW","depth":12,"bounds":{"left":0.33743352,"top":0.8567438,"width":0.013630319,"height":0.009177973},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chunk","depth":10,"bounds":{"left":0.32962102,"top":0.9345571,"width":0.02925532,"height":0.046288908},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Chunk","depth":12,"bounds":{"left":0.33726728,"top":0.96727854,"width":0.013962766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Dashboard All Pipelines","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All Pipelines","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Project Outline app","depth":14,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"app","depth":12,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Overview","depth":12,"bounds":{"left":0.3671875,"top":0.0,"width":0.024102394,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Overview","depth":13,"bounds":{"left":0.3671875,"top":0.0,"width":0.024102394,"height":0.01556265},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Settings","depth":12,"bounds":{"left":0.39660904,"top":0.0,"width":0.021110373,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Settings","depth":13,"bounds":{"left":0.39660904,"top":0.0,"width":0.021110373,"height":0.01556265},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Deploys","depth":12,"bounds":{"left":0.42303857,"top":0.0,"width":0.020611702,"height":0.01915403},"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Deploys","depth":13,"bounds":{"left":0.42303857,"top":0.0,"width":0.020611702,"height":0.01556265},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Lightning Manage triggers","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Manage triggers","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Trigger Pipeline","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pipelines All pipelines my-pipelines-filter","depth":12,"bounds":{"left":0.3671875,"top":0.0,"width":0.053523935,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"All pipelines","depth":15,"bounds":{"left":0.38081783,"top":0.0,"width":0.026263298,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"app Project Filter. Selected \"app\"","depth":12,"bounds":{"left":0.42337102,"top":0.0,"width":0.034242023,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"app","depth":15,"bounds":{"left":0.43567154,"top":0.0,"width":0.00831117,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"All branches Branch Filter. Selected \"All branches\"","depth":12,"bounds":{"left":0.4602726,"top":0.0,"width":0.053025264,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"All branches","depth":15,"bounds":{"left":0.47257313,"top":0.0,"width":0.027094414,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Start Time Cutoff date Arrow Drop Down","depth":12,"bounds":{"left":0.5159575,"top":0.0,"width":0.051030584,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Cutoff date","depth":14,"bounds":{"left":0.52825797,"top":0.0,"width":0.025099734,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"All statuses Arrow Drop Down","depth":12,"bounds":{"left":0.5696476,"top":0.0,"width":0.043218084,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"All","depth":13,"bounds":{"left":0.5739694,"top":0.0,"width":0.0066489363,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"statuses","depth":13,"bounds":{"left":0.5806183,"top":0.0,"width":0.01861702,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Filter Display options","depth":12,"bounds":{"left":0.9333444,"top":0.0,"width":0.0546875,"height":0.031923383},"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Display options","depth":13,"bounds":{"left":0.94830453,"top":0.0,"width":0.034075797,"height":0.01396648},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Pipeline","depth":13,"bounds":{"left":0.37250665,"top":0.035514764,"width":0.015292553,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Status","depth":13,"bounds":{"left":0.4375,"top":0.035514764,"width":0.012466756,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Workflow","depth":13,"bounds":{"left":0.4943484,"top":0.035514764,"width":0.018284574,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Checkout source","depth":13,"bounds":{"left":0.5731383,"top":0.035514764,"width":0.03274601,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Trigger event","depth":13,"bounds":{"left":0.70611703,"top":0.035514764,"width":0.025764627,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Start","depth":13,"bounds":{"left":0.8640292,"top":0.035514764,"width":0.009640957,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Duration","depth":13,"bounds":{"left":0.90226066,"top":0.035514764,"width":0.01662234,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Actions","depth":13,"bounds":{"left":0.92952126,"top":0.035514764,"width":0.014793883,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app","depth":12,"bounds":{"left":0.3728391,"top":0.06384677,"width":0.00831117,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"58412","depth":11,"bounds":{"left":0.3728391,"top":0.080207504,"width":0.013630319,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"58412","depth":12,"bounds":{"left":0.3728391,"top":0.08140463,"width":0.013630319,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.","depth":12,"bounds":{"left":0.4275266,"top":0.06584198,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Running Running","depth":11,"bounds":{"left":0.43949467,"top":0.06743815,"width":0.03274601,"height":0.023144454},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Running","depth":12,"bounds":{"left":0.45013297,"top":0.07222666,"width":0.018118352,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12m 17s","depth":12,"bounds":{"left":0.43949467,"top":0.096169196,"width":0.017453458,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"remain","depth":12,"bounds":{"left":0.45694813,"top":0.096169196,"width":0.016123671,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Info Outline","depth":11,"bounds":{"left":0.4737367,"top":0.0905826,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"build_accept_deploy","depth":11,"bounds":{"left":0.4943484,"top":0.07102953,"width":0.045711435,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_accept_deploy","depth":12,"bounds":{"left":0.4943484,"top":0.07182761,"width":0.045711435,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20904-fix-update-es-on-activity-command","depth":12,"bounds":{"left":0.5728058,"top":0.06424581,"width":0.10538564,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20904-fix-update-es-on-activity-command","depth":13,"bounds":{"left":0.5728058,"top":0.0650439,"width":0.10538564,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":13,"bounds":{"left":0.5728058,"top":0.0830008,"width":0.12765957,"height":0.033519555},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"c70ef5a","depth":15,"bounds":{"left":0.5728058,"top":0.08459697,"width":0.018284574,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Merge branch 'master' into JY-20904-fix-update-es-on-activity-command","depth":15,"bounds":{"left":0.5728058,"top":0.08459697,"width":0.1122008,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Push","depth":12,"bounds":{"left":0.7190825,"top":0.07182761,"width":0.011303191,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Commit pushed","depth":13,"bounds":{"left":0.73171544,"top":0.07182761,"width":0.034574468,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp to clipboard","depth":12,"bounds":{"left":0.84857047,"top":0.06424581,"width":0.030086435,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"13m ago","depth":14,"bounds":{"left":0.85422206,"top":0.07342378,"width":0.018783245,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp duration to clipboard","depth":12,"bounds":{"left":0.89328456,"top":0.06424581,"width":0.030585106,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from start","depth":11,"bounds":{"left":0.92918885,"top":0.06743815,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from failed","depth":11,"bounds":{"left":0.93982714,"top":0.06743815,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Cancel workflow","depth":11,"bounds":{"left":0.95046544,"top":0.06743815,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fix workflow","depth":11,"bounds":{"left":0.96110374,"top":0.06743815,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More Actions","depth":11,"bounds":{"left":0.97174203,"top":0.06743815,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jobs","depth":13,"bounds":{"left":0.41073802,"top":0.1424581,"width":0.010804521,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job checkout-code","depth":13,"bounds":{"left":0.4375,"top":0.14006385,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"checkout-code","depth":14,"bounds":{"left":0.45279256,"top":0.1424581,"width":0.03374335,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887470","depth":15,"bounds":{"left":0.48919547,"top":0.1424581,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"2m 16s","depth":13,"bounds":{"left":0.90226066,"top":0.14006385,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"2m 16s","depth":14,"bounds":{"left":0.90226066,"top":0.1424581,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-frontend","depth":13,"bounds":{"left":0.4375,"top":0.16560255,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-frontend","depth":14,"bounds":{"left":0.45279256,"top":0.16799681,"width":0.032247342,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887471","depth":15,"bounds":{"left":0.48769948,"top":0.16799681,"width":0.015957447,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 16s","depth":13,"bounds":{"left":0.90292555,"top":0.16560255,"width":0.015625,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 16s","depth":14,"bounds":{"left":0.90292555,"top":0.16799681,"width":0.015625,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-frontend","depth":13,"bounds":{"left":0.4375,"top":0.19114126,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-frontend","depth":14,"bounds":{"left":0.45279256,"top":0.19353552,"width":0.029920213,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887472","depth":15,"bounds":{"left":0.48537233,"top":0.19353552,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 31s","depth":13,"bounds":{"left":0.90292555,"top":0.19114126,"width":0.015625,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 31s","depth":14,"bounds":{"left":0.90292555,"top":0.19353552,"width":0.015625,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-backend","depth":13,"bounds":{"left":0.4375,"top":0.21667998,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-backend","depth":14,"bounds":{"left":0.45279256,"top":0.21907422,"width":0.032247342,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887473","depth":15,"bounds":{"left":0.48769948,"top":0.21907422,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"51s","depth":13,"bounds":{"left":0.9109042,"top":0.21667998,"width":0.0076462766,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"51s","depth":14,"bounds":{"left":0.9109042,"top":0.21907422,"width":0.0076462766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job phpstan","depth":13,"bounds":{"left":0.4375,"top":0.24221867,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"phpstan","depth":14,"bounds":{"left":0.45279256,"top":0.24461293,"width":0.018284574,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887477","depth":15,"bounds":{"left":0.4737367,"top":0.24461293,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 21s","depth":13,"bounds":{"left":0.9030917,"top":0.24221867,"width":0.015458777,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 21s","depth":14,"bounds":{"left":0.9030917,"top":0.24461293,"width":0.015458777,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job setup","depth":13,"bounds":{"left":0.4375,"top":0.2677574,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup","depth":14,"bounds":{"left":0.45279256,"top":0.27015164,"width":0.012632979,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887475","depth":15,"bounds":{"left":0.4680851,"top":0.27015164,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"57s","depth":13,"bounds":{"left":0.9105718,"top":0.2677574,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"57s","depth":14,"bounds":{"left":0.9105718,"top":0.27015164,"width":0.007978723,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"RUNNING job test","depth":13,"bounds":{"left":0.4375,"top":0.2932961,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test","depth":14,"bounds":{"left":0.45279256,"top":0.29569036,"width":0.008643617,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887476","depth":15,"bounds":{"left":0.46409574,"top":0.29569036,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"8m 2s","depth":13,"bounds":{"left":0.90458775,"top":0.2932961,"width":0.013962766,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"8m 2s","depth":14,"bounds":{"left":0.90458775,"top":0.29569036,"width":0.013962766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-backend-lint","depth":13,"bounds":{"left":0.4375,"top":0.31883478,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-backend-lint","depth":14,"bounds":{"left":0.45279256,"top":0.32122904,"width":0.038896278,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887474","depth":15,"bounds":{"left":0.4943484,"top":0.32122904,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"4m 13s","depth":13,"bounds":{"left":0.9020944,"top":0.31883478,"width":0.016456118,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4m 13s","depth":14,"bounds":{"left":0.9020944,"top":0.32122904,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sonar_cloud","depth":14,"bounds":{"left":0.45279256,"top":0.34676775,"width":0.02642952,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887478","depth":15,"bounds":{"left":0.48188165,"top":0.34676775,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"SUCCESS workflow setup-workflow. Collapse the workflow jobs list.","depth":12,"bounds":{"left":0.4275266,"top":0.38747007,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Passed Success","depth":11,"bounds":{"left":0.43949467,"top":0.38906625,"width":0.033410903,"height":0.022745412},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Success","depth":12,"bounds":{"left":0.45013297,"top":0.3934557,"width":0.018783245,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"setup-workflow","depth":11,"bounds":{"left":0.4943484,"top":0.39225858,"width":0.03523936,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup-workflow","depth":12,"bounds":{"left":0.4943484,"top":0.39305666,"width":0.03523936,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SETUP","depth":11,"bounds":{"left":0.5349069,"top":0.39505187,"width":0.010970744,"height":0.009976057},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20904-fix-update-es-on-activity-command","depth":12,"bounds":{"left":0.5728058,"top":0.3858739,"width":0.10538564,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20904-fix-update-es-on-activity-command","depth":13,"bounds":{"left":0.5728058,"top":0.386672,"width":0.10538564,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":13,"bounds":{"left":0.5728058,"top":0.4046289,"width":0.12765957,"height":0.033519555},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"c70ef5a","depth":15,"bounds":{"left":0.5728058,"top":0.40622506,"width":0.018284574,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Merge branch 'master' into JY-20904-fix-update-es-on-activity-command","depth":15,"bounds":{"left":0.5728058,"top":0.40622506,"width":0.1122008,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Push","depth":12,"bounds":{"left":0.7190825,"top":0.39305666,"width":0.011303191,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Commit pushed","depth":13,"bounds":{"left":0.73171544,"top":0.39305666,"width":0.034574468,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp to clipboard","depth":12,"bounds":{"left":0.84857047,"top":0.3858739,"width":0.030086435,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"13m ago","depth":14,"bounds":{"left":0.85422206,"top":0.39465284,"width":0.018783245,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp duration to clipboard","depth":12,"bounds":{"left":0.904754,"top":0.3858739,"width":0.019115692,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from start","depth":11,"bounds":{"left":0.92918885,"top":0.38906625,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from failed","depth":11,"bounds":{"left":0.93982714,"top":0.38906625,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Cancel workflow","depth":11,"bounds":{"left":0.95046544,"top":0.38906625,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fix workflow","depth":11,"bounds":{"left":0.96110374,"top":0.38906625,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More Actions","depth":11,"bounds":{"left":0.97174203,"top":0.38906625,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jobs","depth":13,"bounds":{"left":0.41073802,"top":0.4632881,"width":0.010804521,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job setup","depth":13,"bounds":{"left":0.4375,"top":0.46049482,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"setup","depth":14,"bounds":{"left":0.45279256,"top":0.4632881,"width":0.012632979,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887469","depth":15,"bounds":{"left":0.4680851,"top":0.4632881,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"30s","depth":13,"bounds":{"left":0.9099069,"top":0.46049482,"width":0.008643617,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"30s","depth":14,"bounds":{"left":0.9099069,"top":0.4632881,"width":0.008643617,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app","depth":12,"bounds":{"left":0.3728391,"top":0.51276934,"width":0.00831117,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"58411","depth":11,"bounds":{"left":0.3728391,"top":0.5291301,"width":0.012965426,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"58411","depth":12,"bounds":{"left":0.3728391,"top":0.52992815,"width":0.012965426,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.","depth":12,"bounds":{"left":0.4275266,"top":0.51476455,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Status Running Running","depth":11,"bounds":{"left":0.43949467,"top":0.51636076,"width":0.03274601,"height":0.023144454},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Running","depth":12,"bounds":{"left":0.45013297,"top":0.5207502,"width":0.018118352,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"7m 21s","depth":12,"bounds":{"left":0.43949467,"top":0.5450918,"width":0.015458777,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"remain","depth":12,"bounds":{"left":0.45495346,"top":0.5450918,"width":0.016123671,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Info Outline","depth":11,"bounds":{"left":0.47174203,"top":0.5395052,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"build_accept_deploy","depth":11,"bounds":{"left":0.4943484,"top":0.51955307,"width":0.045711435,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build_accept_deploy","depth":12,"bounds":{"left":0.4943484,"top":0.5207502,"width":0.045711435,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"JY-20891-improve-sms-text-relays","depth":12,"bounds":{"left":0.5728058,"top":0.5131684,"width":0.0787899,"height":0.01556265},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20891-improve-sms-text-relays","depth":13,"bounds":{"left":0.5728058,"top":0.5139665,"width":0.0787899,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Open commit on version control site","depth":13,"bounds":{"left":0.5728058,"top":0.5319234,"width":0.12765957,"height":0.033519555},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"772eb11","depth":15,"bounds":{"left":0.5728058,"top":0.53351957,"width":0.018450798,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Merge branch 'master' into JY-20891-improve-sms-text-relays","depth":15,"bounds":{"left":0.5728058,"top":0.53351957,"width":0.123836435,"height":0.030726258},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Push","depth":12,"bounds":{"left":0.7190825,"top":0.5207502,"width":0.011303191,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Commit pushed","depth":13,"bounds":{"left":0.73171544,"top":0.5207502,"width":0.034574468,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp to clipboard","depth":12,"bounds":{"left":0.8487367,"top":0.5131684,"width":0.029920213,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"18m ago","depth":14,"bounds":{"left":0.8543883,"top":0.5223464,"width":0.01861702,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy timestamp duration to clipboard","depth":12,"bounds":{"left":0.89328456,"top":0.5131684,"width":0.030585106,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from start","depth":11,"bounds":{"left":0.92918885,"top":0.51636076,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Rerun workflow from failed","depth":11,"bounds":{"left":0.93982714,"top":0.51636076,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Cancel workflow","depth":11,"bounds":{"left":0.95046544,"top":0.51636076,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fix workflow","depth":11,"bounds":{"left":0.96110374,"top":0.51636076,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":false,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More Actions","depth":11,"bounds":{"left":0.97174203,"top":0.51636076,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jobs","depth":13,"bounds":{"left":0.41073802,"top":0.5913807,"width":0.010804521,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job checkout-code","depth":13,"bounds":{"left":0.4375,"top":0.58898646,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"checkout-code","depth":14,"bounds":{"left":0.45279256,"top":0.5913807,"width":0.03374335,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887460","depth":15,"bounds":{"left":0.48919547,"top":0.5913807,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 13s","depth":13,"bounds":{"left":0.90292555,"top":0.58898646,"width":0.015625,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 13s","depth":14,"bounds":{"left":0.90292555,"top":0.5913807,"width":0.015625,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job build-frontend","depth":13,"bounds":{"left":0.4375,"top":0.61452514,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"build-frontend","depth":14,"bounds":{"left":0.45279256,"top":0.6169194,"width":0.032247342,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887461","depth":15,"bounds":{"left":0.48769948,"top":0.6169194,"width":0.016123671,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 20s","depth":13,"bounds":{"left":0.90226066,"top":0.61452514,"width":0.016289894,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1m 20s","depth":14,"bounds":{"left":0.90226066,"top":0.6169194,"width":0.016289894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"SUCCESS job test-frontend","depth":13,"bounds":{"left":0.4375,"top":0.6400638,"width":0.3179854,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"test-frontend","depth":14,"bounds":{"left":0.45279256,"top":0.6424581,"width":0.029920213,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"887462","depth":15,"bounds":{"left":0.48537233,"top":0.6424581,"width":0.016788565,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"1m 51s","depth":13,"bounds":{"left":0.9030917,"top":0.6400638,"width":0.015458777,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
9086553168094527190
|
2021917784173012689
|
visual_change
|
accessibility
|
NULL
|
Platform Sprint 4 Q2 - Platform Team - Scrum Board Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20904 Fix UpdateActivityElasticSearchDocumentCommand find activity… by LakyLak · Pull Request #12078 · jiminny/app
JY-20904 Fix UpdateActivityElasticSearchDocumentCommand find activity… by LakyLak · Pull Request #12078 · jiminny/app
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20903 Update activity stage when opportunity is changed by LakyLak · Pull Request #12077 · jiminny/app
JY-20891 add support for secondary email by LakyLak · Pull Request #12073 · jiminny/app
JY-20891 add support for secondary email by LakyLak · Pull Request #12073 · jiminny/app
[SRD-6853] Moxso - Potential deal stages bug - Jira
[SRD-6853] Moxso - Potential deal stages bug - Jira
Service-Desk - Queues - Platform team - Service space - Jira
Service-Desk - Queues - Platform team - Service space - Jira
Pipelines - jiminny/app
Pipelines - jiminny/app
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Go to home page
Auto theme
Open notifications
Open support menu
Open user menu
org avatar Current organization: jiminny
Home
Home
Pipelines
Pipelines
Projects
Projects
Deploys
Deploys
Insights
Insights
Runners
Runners
Org
Org
Plan
Plan
Chunk sidecars
Chunk sidecars
PREVIEW
Chunk
Chunk
Dashboard All Pipelines
All Pipelines
Project Outline app
app
app
app
Overview
Overview
Settings
Settings
Deploys
Deploys
Lightning Manage triggers
Manage triggers
Trigger Pipeline
Pipelines All pipelines my-pipelines-filter
All pipelines
app Project Filter. Selected "app"
app
All branches Branch Filter. Selected "All branches"
All branches
Start Time Cutoff date Arrow Drop Down
Cutoff date
All statuses Arrow Drop Down
All
statuses
Filter Display options
Display options
Pipeline
Status
Workflow
Checkout source
Trigger event
Start
Duration
Actions
app
58412
58412
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
12m 17s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20904-fix-update-es-on-activity-command
JY-20904-fix-update-es-on-activity-command
Open commit on version control site
c70ef5a
Merge branch 'master' into JY-20904-fix-update-es-on-activity-command
Push
Commit pushed
Copy timestamp to clipboard
13m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Rerun workflow from failed
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
887470
2m 16s
2m 16s
SUCCESS job build-frontend
build-frontend
887471
1m 16s
1m 16s
SUCCESS job test-frontend
test-frontend
887472
1m 31s
1m 31s
SUCCESS job build-backend
build-backend
887473
51s
51s
SUCCESS job phpstan
phpstan
887477
1m 21s
1m 21s
SUCCESS job setup
setup
887475
57s
57s
RUNNING job test
test
887476
8m 2s
8m 2s
SUCCESS job test-backend-lint
test-backend-lint
887474
4m 13s
4m 13s
sonar_cloud
887478
SUCCESS workflow setup-workflow. Collapse the workflow jobs list.
Status Passed Success
Success
setup-workflow
setup-workflow
SETUP
JY-20904-fix-update-es-on-activity-command
JY-20904-fix-update-es-on-activity-command
Open commit on version control site
c70ef5a
Merge branch 'master' into JY-20904-fix-update-es-on-activity-command
Push
Commit pushed
Copy timestamp to clipboard
13m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Rerun workflow from failed
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job setup
setup
887469
30s
30s
app
58411
58411
RUNNING workflow build_accept_deploy. Collapse the workflow jobs list.
Status Running Running
Running
7m 21s
remain
Info Outline
build_accept_deploy
build_accept_deploy
JY-20891-improve-sms-text-relays
JY-20891-improve-sms-text-relays
Open commit on version control site
772eb11
Merge branch 'master' into JY-20891-improve-sms-text-relays
Push
Commit pushed
Copy timestamp to clipboard
18m ago
Copy timestamp duration to clipboard
Rerun workflow from start
Rerun workflow from failed
Cancel workflow
Fix workflow
More Actions
Jobs
SUCCESS job checkout-code
checkout-code
887460
1m 13s
1m 13s
SUCCESS job build-frontend
build-frontend
887461
1m 20s
1m 20s
SUCCESS job test-frontend
test-frontend
887462
1m 51s...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
33352
|
1268
|
20
|
2026-05-13T10:15:39.668955+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778667339668_m1.jpg...
|
PhpStorm
|
faVsco.js – EmailTextRelay.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Analyzing…","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Jobs\\Mailbox;\n\nuse Illuminate\\Support\\Str;\nuse Carbon\\Carbon;\nuse Google\\Service\\Gmail as GoogleGmail;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Jiminny\\Component\\Queue\\Constants;\nuse Jiminny\\Contracts\\Acl\\PermissionEnum;\nuse Jiminny\\Exceptions\\TextRelayException;\nuse Jiminny\\Jobs\\Job;\nuse EmailReplyParser\\Parser\\EmailParser;\nuse Jiminny\\Mail\\Activities\\SmsRelayFailed;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\TextRelay;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Rules\\SmsMessage;\nuse Jiminny\\Services\\Mail\\TextRelayService;\nuse Jiminny\\Services\\Telephony\\TextMessagingService;\nuse Vinkla\\Hashids\\Facades\\Hashids;\nuse Validator;\n\nclass EmailTextRelay extends Job implements ShouldQueue\n{\n use InteractsWithQueue;\n use SerializesModels;\n\n private const REASON_CODE_MAILBOX_MISMATCH = 1000;\n\n private const REASON_CODE_SENDER_UNKNOWN = 2000;\n\n private const REASON_CODE_SENDER_MISMATCH = 2100;\n\n private const REASON_CODE_SENDER_FORBIDDEN = 2200;\n\n private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;\n\n private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;\n\n private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;\n\n private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;\n\n private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;\n\n private const REASON_CODE_INVALID_HASH = 5000;\n\n private const REASON_CODE_UNKNOWN = 10000;\n\n\n private $textRelay;\n\n private $messageId;\n\n private $to;\n\n private $text;\n\n /**\n * @var Activity\n */\n private $activityOrigin;\n\n /**\n * Create a new job instance.\n */\n public function __construct(string $messageId, TextRelay $textRelay)\n {\n $this->messageId = $messageId;\n $this->textRelay = $textRelay;\n }\n\n /**\n * Execute the job.\n */\n public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void\n {\n if (config('jiminny.google_text_host') === null) {\n return;\n }\n\n $mailService = $relayService->getService(config('jiminny.google_text_user'));\n\n try {\n // Retrieve the message from the email server.\n $message = $this->getMessage($mailService, $this->messageId);\n\n $payload = $message->getPayload();\n\n $headers = $this->getHeaders($payload->getHeaders());\n\n $date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);\n\n $this->textRelay->update([\n 'email_sent_at' => $date,\n 'sender' => Str::limit($headers['From'], 191, ''),\n 'recipient' => Str::limit($headers['To'], 191, ''),\n ]);\n\n $this->checkIntegrity($payload);\n\n $user = $this->activityOrigin->user;\n\n // Create the activity and send the SMS.\n $messagingService->setTeam($user->team);\n\n $message = $messagingService->send(\n $user,\n $this->to,\n $this->text\n );\n\n $activity = $messagingService->buildActivity(\n $message->sid,\n Activity::TYPE_SMS_OUTBOUND,\n $user,\n $user->softphone_number,\n $this->to,\n $this->text,\n $this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,\n strtolower($this->activityOrigin->prospect_type),\n null\n );\n\n $this->textRelay->update([\n 'origin_activity_id' => $this->activityOrigin->id,\n 'activity_id' => $activity->id,\n 'status' => TextRelay::STATUS_PROCESSED,\n ]);\n } catch (TextRelayException $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => $e->getCode(),\n ]);\n\n $sender = $this->parseSender($headers['From']);\n\n // If we can pull the sender, tell them that it failed.\n if ($sender) {\n $responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))\n ->onQueue(Constants::QUEUE_EMAILS);\n\n \\Mail::to($sender)->queue($responder);\n }\n } catch (\\Exception $e) {\n $this->textRelay->update([\n 'status' => TextRelay::STATUS_FAILED,\n 'code' => self::REASON_CODE_UNKNOWN,\n ]);\n\n \\Sentry::captureException($e);\n } finally {\n // Delete the message from the email server (it lives for 30 days).\n $this->trashMessage($mailService, $this->messageId);\n }\n }\n\n /**\n * @param GoogleGmail\\MessagePartHeader[] $rawHeaders\n */\n private function getHeaders(array $rawHeaders): array\n {\n $headers = [];\n\n foreach ($rawHeaders as $header) {\n if (\\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {\n $headers[$header->name] = $header->value;\n }\n }\n\n return $headers;\n }\n\n /**\n * @param GoogleGmail\\MessagePart[] $rawBodyParts\n */\n private function getBody(array $rawBodyParts): ?string\n {\n $body = null;\n\n foreach ($rawBodyParts as $bodyPart) {\n /* @var $bodyPart GoogleGmail\\MessagePart */\n if ($bodyPart->mimeType === 'text/plain') {\n $body = $this->base64UrlDecode($bodyPart->getBody()->getData());\n }\n }\n\n return $body;\n }\n\n private function parseSender(string $sender): ?string\n {\n preg_match_all(\n '/\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}\\b/i',\n $sender,\n $matches,\n PREG_PATTERN_ORDER\n );\n\n return $matches[0][0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipient(string $recipient): string\n {\n preg_match(\n '/\\d+\\.\\d+\\.[a-zA-Z0-9]{10}@txt\\.(?:staging\\.)?jiminny\\.com/i',\n $recipient,\n $matches\n );\n\n if ($matches == false) {\n // This should not happen. If it does, the mailbox allowed an invalid catch-all.\n throw new TextRelayException(\n 'Recipient is missing or invalid.',\n self::REASON_CODE_RECIPIENT_MISSING_INVALID\n );\n }\n\n // Reply-To consists of digits.digits.string@mailbox\n return $matches[0];\n }\n\n /**\n * @throws \\Exception\n */\n private function parseRecipientIntoEntities(string $recipient): array\n {\n // Convert From/To/Activity into their usable types.\n [$from, $to, $encodedActivityId] = explode('.', $recipient);\n\n $from = '+' . $from;\n $to = '+' . $to;\n $activityId = Hashids::decode($encodedActivityId);\n\n return [$from, $to, $activityId];\n }\n\n /**\n * @throws \\Exception\n */\n private function checkIntegrity(GoogleGmail\\MessagePart $payload)\n {\n $headers = $this->getHeaders($payload->getHeaders());\n $body = $this->getBody($payload->getParts());\n\n // Parse the email body and check it can actually be sent.\n $email = (new EmailParser())->parse($body);\n $text = $email->getVisibleText();\n\n if ($text === '') {\n throw new TextRelayException(\n 'Message body is un-readable or empty.',\n self::REASON_CODE_MESSAGE_BODY_EMPTY\n );\n }\n\n $validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Message body is too large to send as an SMS.',\n self::REASON_CODE_MESSAGE_BODY_TOO_LARGE\n );\n }\n\n $this->text = $text;\n\n $sender = $this->parseSender($headers['From']);\n\n // Extract the Jiminny recipient.\n $recipient = explode('@', $this->parseRecipient($headers['To']));\n\n // Check this message is intended for us.\n if ($recipient[1] !== config('jiminny.google_text_host')) {\n throw new TextRelayException(\n 'Destination Mailbox does not match.',\n self::REASON_CODE_MAILBOX_MISMATCH\n );\n }\n\n [$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);\n\n $validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient origin number is not valid.',\n self::REASON_CODE_RECIPIENT_ORIGIN_INVALID\n );\n }\n\n $validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);\n if ($validator->fails()) {\n throw new TextRelayException(\n 'Recipient destination number is not valid.',\n self::REASON_CODE_RECIPIENT_DESTINATION_INVALID\n );\n }\n\n $user = User::where('email', $sender)->first();\n if ($user === null) {\n throw new TextRelayException(\n 'Sender does not exist.',\n self::REASON_CODE_SENDER_UNKNOWN\n );\n }\n\n if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {\n throw new TextRelayException(\n 'Messaging is not enabled for this account.',\n self::REASON_CODE_SENDER_FORBIDDEN\n );\n }\n\n if ($activityId === null) {\n throw new TextRelayException(\n 'Origin activity has an invalid hash.',\n self::REASON_CODE_INVALID_HASH\n );\n }\n\n $activity = Activity::where('id', $activityId)->first();\n if ($activity && $activity->user_id !== $user->id) {\n throw new TextRelayException(\n 'Sender does not match the origin activity.',\n self::REASON_CODE_SENDER_MISMATCH\n );\n }\n\n $this->activityOrigin = $activity;\n $this->to = $to;\n }\n\n /**\n * Returns a base64 decoded web safe string\n *\n * @param string $string The string to be decoded\n *\n * @return string Decoded string\n */\n private function base64UrlDecode(string $string): string\n {\n return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));\n }\n\n public function getMessage($service, $messageId): GoogleGmail\\Message\n {\n return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);\n }\n\n public function trashMessage($service, $messageId)\n {\n return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"64","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9086514338059290483
|
2218635325254022725
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
Analyzing…
<?php
namespace Jiminny\Jobs\Mailbox;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Google\Service\Gmail as GoogleGmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Jiminny\Component\Queue\Constants;
use Jiminny\Contracts\Acl\PermissionEnum;
use Jiminny\Exceptions\TextRelayException;
use Jiminny\Jobs\Job;
use EmailReplyParser\Parser\EmailParser;
use Jiminny\Mail\Activities\SmsRelayFailed;
use Jiminny\Models\Activity;
use Jiminny\Models\TextRelay;
use Jiminny\Models\User;
use Jiminny\Rules\SmsMessage;
use Jiminny\Services\Mail\TextRelayService;
use Jiminny\Services\Telephony\TextMessagingService;
use Vinkla\Hashids\Facades\Hashids;
use Validator;
class EmailTextRelay extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
private const REASON_CODE_MAILBOX_MISMATCH = 1000;
private const REASON_CODE_SENDER_UNKNOWN = 2000;
private const REASON_CODE_SENDER_MISMATCH = 2100;
private const REASON_CODE_SENDER_FORBIDDEN = 2200;
private const REASON_CODE_RECIPIENT_ORIGIN_INVALID = 3000;
private const REASON_CODE_RECIPIENT_DESTINATION_INVALID = 3100;
private const REASON_CODE_RECIPIENT_MISSING_INVALID = 3200;
private const REASON_CODE_MESSAGE_BODY_TOO_LARGE = 4000;
private const REASON_CODE_MESSAGE_BODY_EMPTY = 4100;
private const REASON_CODE_INVALID_HASH = 5000;
private const REASON_CODE_UNKNOWN = 10000;
private $textRelay;
private $messageId;
private $to;
private $text;
/**
* @var Activity
*/
private $activityOrigin;
/**
* Create a new job instance.
*/
public function __construct(string $messageId, TextRelay $textRelay)
{
$this->messageId = $messageId;
$this->textRelay = $textRelay;
}
/**
* Execute the job.
*/
public function handle(TextMessagingService $messagingService, TextRelayService $relayService): void
{
if (config('jiminny.google_text_host') === null) {
return;
}
$mailService = $relayService->getService(config('jiminny.google_text_user'));
try {
// Retrieve the message from the email server.
$message = $this->getMessage($mailService, $this->messageId);
$payload = $message->getPayload();
$headers = $this->getHeaders($payload->getHeaders());
$date = Carbon::createFromFormat(Carbon::RFC2822, $headers['Date']);
$this->textRelay->update([
'email_sent_at' => $date,
'sender' => Str::limit($headers['From'], 191, ''),
'recipient' => Str::limit($headers['To'], 191, ''),
]);
$this->checkIntegrity($payload);
$user = $this->activityOrigin->user;
// Create the activity and send the SMS.
$messagingService->setTeam($user->team);
$message = $messagingService->send(
$user,
$this->to,
$this->text
);
$activity = $messagingService->buildActivity(
$message->sid,
Activity::TYPE_SMS_OUTBOUND,
$user,
$user->softphone_number,
$this->to,
$this->text,
$this->activityOrigin->prospect ? $this->activityOrigin->prospect->crm_provider_id : null,
strtolower($this->activityOrigin->prospect_type),
null
);
$this->textRelay->update([
'origin_activity_id' => $this->activityOrigin->id,
'activity_id' => $activity->id,
'status' => TextRelay::STATUS_PROCESSED,
]);
} catch (TextRelayException $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => $e->getCode(),
]);
$sender = $this->parseSender($headers['From']);
// If we can pull the sender, tell them that it failed.
if ($sender) {
$responder = (new SmsRelayFailed($this->textRelay, $e->getMessage(), $e->getCode()))
->onQueue(Constants::QUEUE_EMAILS);
\Mail::to($sender)->queue($responder);
}
} catch (\Exception $e) {
$this->textRelay->update([
'status' => TextRelay::STATUS_FAILED,
'code' => self::REASON_CODE_UNKNOWN,
]);
\Sentry::captureException($e);
} finally {
// Delete the message from the email server (it lives for 30 days).
$this->trashMessage($mailService, $this->messageId);
}
}
/**
* @param GoogleGmail\MessagePartHeader[] $rawHeaders
*/
private function getHeaders(array $rawHeaders): array
{
$headers = [];
foreach ($rawHeaders as $header) {
if (\in_array($header->name, ['To', 'From', 'X-Gm-Original-To', 'Date'])) {
$headers[$header->name] = $header->value;
}
}
return $headers;
}
/**
* @param GoogleGmail\MessagePart[] $rawBodyParts
*/
private function getBody(array $rawBodyParts): ?string
{
$body = null;
foreach ($rawBodyParts as $bodyPart) {
/* @var $bodyPart GoogleGmail\MessagePart */
if ($bodyPart->mimeType === 'text/plain') {
$body = $this->base64UrlDecode($bodyPart->getBody()->getData());
}
}
return $body;
}
private function parseSender(string $sender): ?string
{
preg_match_all(
'/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i',
$sender,
$matches,
PREG_PATTERN_ORDER
);
return $matches[0][0];
}
/**
* @throws \Exception
*/
private function parseRecipient(string $recipient): string
{
preg_match(
'/\d+\.\d+\.[a-zA-Z0-9]{10}@txt\.(?:staging\.)?jiminny\.com/i',
$recipient,
$matches
);
if ($matches == false) {
// This should not happen. If it does, the mailbox allowed an invalid catch-all.
throw new TextRelayException(
'Recipient is missing or invalid.',
self::REASON_CODE_RECIPIENT_MISSING_INVALID
);
}
// Reply-To consists of digits.digits.string@mailbox
return $matches[0];
}
/**
* @throws \Exception
*/
private function parseRecipientIntoEntities(string $recipient): array
{
// Convert From/To/Activity into their usable types.
[$from, $to, $encodedActivityId] = explode('.', $recipient);
$from = '+' . $from;
$to = '+' . $to;
$activityId = Hashids::decode($encodedActivityId);
return [$from, $to, $activityId];
}
/**
* @throws \Exception
*/
private function checkIntegrity(GoogleGmail\MessagePart $payload)
{
$headers = $this->getHeaders($payload->getHeaders());
$body = $this->getBody($payload->getParts());
// Parse the email body and check it can actually be sent.
$email = (new EmailParser())->parse($body);
$text = $email->getVisibleText();
if ($text === '') {
throw new TextRelayException(
'Message body is un-readable or empty.',
self::REASON_CODE_MESSAGE_BODY_EMPTY
);
}
$validator = Validator::make(['data' => $text], ['data' => new SmsMessage()]);
if ($validator->fails()) {
throw new TextRelayException(
'Message body is too large to send as an SMS.',
self::REASON_CODE_MESSAGE_BODY_TOO_LARGE
);
}
$this->text = $text;
$sender = $this->parseSender($headers['From']);
// Extract the Jiminny recipient.
$recipient = explode('@', $this->parseRecipient($headers['To']));
// Check this message is intended for us.
if ($recipient[1] !== config('jiminny.google_text_host')) {
throw new TextRelayException(
'Destination Mailbox does not match.',
self::REASON_CODE_MAILBOX_MISMATCH
);
}
[$from, $to, $activityId] = $this->parseRecipientIntoEntities($recipient[0]);
$validator = Validator::make(['data' => $from], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient origin number is not valid.',
self::REASON_CODE_RECIPIENT_ORIGIN_INVALID
);
}
$validator = Validator::make(['data' => $to], ['data' => 'phone:INTERNATIONAL']);
if ($validator->fails()) {
throw new TextRelayException(
'Recipient destination number is not valid.',
self::REASON_CODE_RECIPIENT_DESTINATION_INVALID
);
}
$user = User::where('email', $sender)->first();
if ($user === null) {
throw new TextRelayException(
'Sender does not exist.',
self::REASON_CODE_SENDER_UNKNOWN
);
}
if ($user->softphone_number === null || ! $user->hasPermission(PermissionEnum::SMS)) {
throw new TextRelayException(
'Messaging is not enabled for this account.',
self::REASON_CODE_SENDER_FORBIDDEN
);
}
if ($activityId === null) {
throw new TextRelayException(
'Origin activity has an invalid hash.',
self::REASON_CODE_INVALID_HASH
);
}
$activity = Activity::where('id', $activityId)->first();
if ($activity && $activity->user_id !== $user->id) {
throw new TextRelayException(
'Sender does not match the origin activity.',
self::REASON_CODE_SENDER_MISMATCH
);
}
$this->activityOrigin = $activity;
$this->to = $to;
}
/**
* Returns a base64 decoded web safe string
*
* @param string $string The string to be decoded
*
* @return string Decoded string
*/
private function base64UrlDecode(string $string): string
{
return base64_decode(str_replace(['-', '_'], ['+', '/'], $string));
}
public function getMessage($service, $messageId): GoogleGmail\Message
{
return $service->users_messages->get(config('jiminny.google_text_user'), $messageId);
}
public function trashMessage($service, $messageId)
{
return $service->users_messages->trash(config('jiminny.google_text_user'), $messageId);
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
64
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
58528
|
2075
|
3
|
2026-05-19T12:49:15.668504+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-19/1779 /Users/lukas/.screenpipe/data/data/2026-05-19/1779194955668_m2.jpg...
|
Firefox
|
NULL
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Notion CalendarVIewWindow?9 master [EMAIL]=.phpuni Notion CalendarVIewWindow?9 master [EMAIL]=.phpunit.result.cacheE .prettierignore= windsurtrulesphpde neloer.onophpide heloer_models.ohophp artisanM'CLAUDE.mdcomooser.isoncomooser.lockdependency-checker.json8 dev ison= ids tytl=infection.ison.distMLINSTAlI.mdMLINTERNAl WERHOOk SFTUP mdEjiminny_storageMiliconsos mdllM Makefile1рackace-lock. sonE phpstan.neon.dist= phostan-baseline.neon<> phpunit.xmlTe raw sal query.saM+ README.mdsô sonar-proiect propertiesE test.ov‹> Untitled Diaaram.xmliusvetur.confio.isM+ WEBHOOK FILTERING_IMPLEMENTATION.mo>1h External Librariesv =° Scratches and Consolesv batabase Consolesv AEU# console (EUlI DEAL RISKS (SU1A DITEUlA EU (EU]v Ajiminny@localhostA console (jiminny@localhost]# Di liiminny@localhostlChecked out mactenfliminny@localhost]ny@localhost]& zoho dev [iiminny@localhost]V & PRODA console [PROD]& console 1 [PROD1LDIPROD© ActivityController.php© ConvertLeadActivities.phpC) SaveActivity.pnp© PurgeLookupCache.php© SyncPlanhat.phpo synerorlannatpnpAcuivityLeadConverted.php© UserAutomatedreporscontroller.phpx© PlaybackController.php)Inteqrationapp/service.ono© LeadConverted.phpC) CreateCommentedEvent.php(C) CreateSmsSentEvent.phpC) PlanhatActivityListener.php© AskAnythingPromptService.php(C) AutomatedReportsRepositorv.php© AutomatedReportsCommand.phpphp api_v2.phpC) RequestGenerateReportJob.php© AutomatedReportResult.php(C) AutomatedReport.ohouse Jiminny \Services \Kiosk \AutomatedReports\ReportSortDirection;use Jiminny \Services\PlanhatService;BI4NLAYuse ectumtnace hutp kequestuse Inrowable,class userauconacedreporcsconcrocler excenos controutenpublic const int RESULTS PER_ PAGE = 25:public const string SORT COLUMN = 'sort column':public const strina SORT DIRECTION = "sort direction':public function constructprivate readonly AutomatedReportsRepository $automatedReportsRepository.private readonly AutomatedRenortsService SautomatedRenortsServicelorivate readoniv AniResponseService samiResponseServi.ce.orivate readoni.v Resnonse Sresnonse.private readonly PlanhatService $planhatService,1...poST lani/v1lautomated-renorts/interest 1usaaepublic function trackInterest(Request $request): JsonResponset...}* Othnows ApplicationException58(09 >GET /api/v1/automated-reportspublic function list(Request Srequest): JsonResponse(...}125 0)DELETE /api/vl/automated-reports/kuuidpublic function delete(Request Srequest, string Suuid): JsonResponsef...}=custom.log= laravel.logA console [STAGING] -607608609610-611612617CONCAT(u.id, CASSd.xt.owner_id FROMJOIN users u on u.idJOIN teams t 1..n<->WHERE u.team_id = 58SELECT * FROM automaselect * from teacuiselect * from team_fselect * from teamswhere 1d = 54: # 4fdSELECT * FROM autonselect * From autom:SELECT * FROM automeselect * From autonselect * from opportSELECT * FROM teamssplect * from nlavhoSELECT * FROM playboSELECT * EROM com fjSELECT * FROM crm_fiCCLSCT + CDOM enm £4lSELECT * FROM crm_coSELECTCONCATU.1d, CASsa.*t.owner_id FROMJoin usens u on U.1dJOuN teams + 1..n<->WHERE U,team id = 71SELEC * FROM com orsplect * From leadsisplect * from calendSELECT+id AS team idiMay 2026 Week21Mon 1%Tue 19Chloe Cross (Parental Leave - 256 days)Andrea Llatanova (Parental Leave - Toy days)Todor Stamatov (PTO - 2 days)Gabriela Dureva (PTO - 0.5 days)Delete saved search and panor....Wed 2007:00Daily - Platform 09:45Daily - Platform 09:45nntor Support Daily Support Daily 15:00Support Daily 15:00lattormy keir22:00ThuzOliver Harris (PTO - 2 days)Daily - Platform 09:45Support Daily 15:00Fri22lliyana Netseva (PTO - 2 days)Stetka Stovanova (PTO - days)Sat23100% LzF• lue 19 May 10.49:10Week vTodavSun 24Culture and Literacy DayDaily - Platform 09:45Support Daily 15:00...
|
NULL
|
9086314093872472421
|
NULL
|
idle
|
ocr
|
NULL
|
Notion CalendarVIewWindow?9 master [EMAIL]=.phpuni Notion CalendarVIewWindow?9 master [EMAIL]=.phpunit.result.cacheE .prettierignore= windsurtrulesphpde neloer.onophpide heloer_models.ohophp artisanM'CLAUDE.mdcomooser.isoncomooser.lockdependency-checker.json8 dev ison= ids tytl=infection.ison.distMLINSTAlI.mdMLINTERNAl WERHOOk SFTUP mdEjiminny_storageMiliconsos mdllM Makefile1рackace-lock. sonE phpstan.neon.dist= phostan-baseline.neon<> phpunit.xmlTe raw sal query.saM+ README.mdsô sonar-proiect propertiesE test.ov‹> Untitled Diaaram.xmliusvetur.confio.isM+ WEBHOOK FILTERING_IMPLEMENTATION.mo>1h External Librariesv =° Scratches and Consolesv batabase Consolesv AEU# console (EUlI DEAL RISKS (SU1A DITEUlA EU (EU]v Ajiminny@localhostA console (jiminny@localhost]# Di liiminny@localhostlChecked out mactenfliminny@localhost]ny@localhost]& zoho dev [iiminny@localhost]V & PRODA console [PROD]& console 1 [PROD1LDIPROD© ActivityController.php© ConvertLeadActivities.phpC) SaveActivity.pnp© PurgeLookupCache.php© SyncPlanhat.phpo synerorlannatpnpAcuivityLeadConverted.php© UserAutomatedreporscontroller.phpx© PlaybackController.php)Inteqrationapp/service.ono© LeadConverted.phpC) CreateCommentedEvent.php(C) CreateSmsSentEvent.phpC) PlanhatActivityListener.php© AskAnythingPromptService.php(C) AutomatedReportsRepositorv.php© AutomatedReportsCommand.phpphp api_v2.phpC) RequestGenerateReportJob.php© AutomatedReportResult.php(C) AutomatedReport.ohouse Jiminny \Services \Kiosk \AutomatedReports\ReportSortDirection;use Jiminny \Services\PlanhatService;BI4NLAYuse ectumtnace hutp kequestuse Inrowable,class userauconacedreporcsconcrocler excenos controutenpublic const int RESULTS PER_ PAGE = 25:public const string SORT COLUMN = 'sort column':public const strina SORT DIRECTION = "sort direction':public function constructprivate readonly AutomatedReportsRepository $automatedReportsRepository.private readonly AutomatedRenortsService SautomatedRenortsServicelorivate readoniv AniResponseService samiResponseServi.ce.orivate readoni.v Resnonse Sresnonse.private readonly PlanhatService $planhatService,1...poST lani/v1lautomated-renorts/interest 1usaaepublic function trackInterest(Request $request): JsonResponset...}* Othnows ApplicationException58(09 >GET /api/v1/automated-reportspublic function list(Request Srequest): JsonResponse(...}125 0)DELETE /api/vl/automated-reports/kuuidpublic function delete(Request Srequest, string Suuid): JsonResponsef...}=custom.log= laravel.logA console [STAGING] -607608609610-611612617CONCAT(u.id, CASSd.xt.owner_id FROMJOIN users u on u.idJOIN teams t 1..n<->WHERE u.team_id = 58SELECT * FROM automaselect * from teacuiselect * from team_fselect * from teamswhere 1d = 54: # 4fdSELECT * FROM autonselect * From autom:SELECT * FROM automeselect * From autonselect * from opportSELECT * FROM teamssplect * from nlavhoSELECT * FROM playboSELECT * EROM com fjSELECT * FROM crm_fiCCLSCT + CDOM enm £4lSELECT * FROM crm_coSELECTCONCATU.1d, CASsa.*t.owner_id FROMJoin usens u on U.1dJOuN teams + 1..n<->WHERE U,team id = 71SELEC * FROM com orsplect * From leadsisplect * from calendSELECT+id AS team idiMay 2026 Week21Mon 1%Tue 19Chloe Cross (Parental Leave - 256 days)Andrea Llatanova (Parental Leave - Toy days)Todor Stamatov (PTO - 2 days)Gabriela Dureva (PTO - 0.5 days)Delete saved search and panor....Wed 2007:00Daily - Platform 09:45Daily - Platform 09:45nntor Support Daily Support Daily 15:00Support Daily 15:00lattormy keir22:00ThuzOliver Harris (PTO - 2 days)Daily - Platform 09:45Support Daily 15:00Fri22lliyana Netseva (PTO - 2 days)Stetka Stovanova (PTO - days)Sat23100% LzF• lue 19 May 10.49:10Week vTodavSun 24Culture and Literacy DayDaily - Platform 09:45Support Daily 15:00...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
87524
|
2987
|
21
|
2026-05-28T15:43:12.291862+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-28/1779 /Users/lukas/.screenpipe/data/data/2026-05-28/1779982992291_m2.jpg...
|
PhpStorm
|
faVsco.js – OpportunitySyncTrait.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12121 on JY-20963-fix-im Project: faVsco.js, menu
#12121 on JY-20963-fix-import-on-deleted-entity, menu
Start Listening for PHP Debug Connections
ServiceTest
Run 'ServiceTest'
Debug 'ServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
cachedClosedDealStages
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/4
Previous Occurrence
Next Occurrence
Filter Search Results...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12121 on JY-20963-fix-import-on-deleted-entity, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.11569149,"height":0.025538707},"on_screen":true,"help_text":"Pull request #12121 exists for current branch JY-20963-fix-import-on-deleted-entity, but pull request details loading failed","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.85638297,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ServiceTest","depth":6,"bounds":{"left":0.87167555,"top":0.019952115,"width":0.043882977,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'ServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'ServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.11868351,"top":0.1300878,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.13131648,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"cachedClosedDealStages","depth":4,"bounds":{"left":0.14228724,"top":0.1292897,"width":0.052526597,"height":0.015961692},"on_screen":true,"value":"cachedClosedDealStages","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.20378989,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.2137633,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.22240691,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.23105054,"top":0.1292897,"width":0.00731383,"height":0.017557861},"on_screen":true,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"on_screen":false,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"on_screen":false,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/4","depth":4,"bounds":{"left":0.24468085,"top":0.12849163,"width":0.025598405,"height":0.017557861},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.27027926,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.2789229,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.28756648,"top":0.12769353,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9086266730295906319
|
-8092471246644454452
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
#12121 on JY-20963-fix-im Project: faVsco.js, menu
#12121 on JY-20963-fix-import-on-deleted-entity, menu
Start Listening for PHP Debug Connections
ServiceTest
Run 'ServiceTest'
Debug 'ServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
cachedClosedDealStages
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/4
Previous Occurrence
Next Occurrence
Filter Search Results
rapstomCoocFV faVsco.|s ~e t2t2t at-nhosa.foae› D RedisD Service TraitsOppontunisinettenswsuncetmahorusncrieeoiuwwecmrto> D UtilsJ—WeonooK©barchsynceo ecror.pipCBacSVnckewwoe© elent.phgC) @osed DealStagesservicelDeallFieldsService ohdC) Decorate,ctimtv choc) Fediivoeconverter.onorosooteentintertace.onCtosootTokenVansoer.oC PawlosdBullder.onoCRAmoreemac selino ol« PesnoncaNormalize nhoc Canes non© SyncFieldAction.php©) SyncRelatedActivityManase Wanhod Cuneiotthoe> B IntegrationApoMlictonore>@ Metadata> Migration& PipedrivevM SalostorcerieldsOoonunyoneOooonuRWWnodP-WostechecwdPANEMCHKGI©) DecorateActivity.cho€ FieldDefinitions.choc PaviosdBullder.onoC Profile.ohoC Oueryet der ono© QuervHandler.ohoc) Ouwviterator.choc Ouwyeeet teonoc) [EMAIL] nhnoPoeocon.no nhrUimacurayscrvict.onoCacieoseoDraistades20.1125 Kovalk0104228 NikOlO20104228 NikOlO18.11.25 Kovalik18.11.25 Kovalik18.11.25 Kovalik18.11.25 Kovalik17.04.26 ilian17.04.26 ilian17.04.20 lllal12.09 26 KouaSy13.02.20 KOVJIK18.11.25 Koval18.11.25 Koval18.11.25 KovalRaRiWeKOWRRIWeKOW18.11.25 KovaR18x1S184112518.11.25 KovaR18.1125Kownirk18.11.25 Kovalk17.0426Tian13.02 26 Kovalr18.1125Kowalk18.11.25 Kovalik1R11DL Kouat18.11.25 Kovalik18.11.25 Kovallk17.04.26 ilian17.04.26 ilian18.11.25 Kovalik194126 Nnuesy18.11.25 Kovark10710701991189%[CREDIT_CARD]/)113%CSamviceTesconr=custom.loglaravel.lodA SF jiminny@localhostHSJocal jiminny@localhost© RecordSelector.phgA console (PRODC) Salesforce/Service.phgA console (EU X iin users (EU# console [STAGINGOpportunitySyncTrait.php x C CrmEntityRepository.phgDe00tTc Autowecw*1698trait OpportunitySyncirait1 usage475 X2 X22 ^ v 1695—1780private function getcachedBusinessProcessRecordtype(BusinessProcess SbusinessProcess): n17311782E1735private function resolveBusinessProcess(?string Spipelineld): ?BusinessProcess=17841789if (Spipelineld za= nulb) 1return null;=1786—1787ScacheKey = Sthis->getBusinessProcessCacheKey(Spipelineid):if (isset(Sthis-›cachedBusinessProcesses(ScacheKey)) {17161711recorn scisescacheobusznessrrocesses scachekeyr-171SbusinessProcess = Sthis->getBusinessProcess(SpipeLineid):Sif ( SbusinessProcess instanceof BusinessProcess) $1714-171517161717nsosToNooesenSbusiinessProcess = Sthis->oetBusinessProcess(Soioelineid):if (I $businessProcess instanceof BusinessProcess) ‹'[HubSpot) Deal is not attached to a pipeline',opetine e SooesineralSthis->cachedBusineseProcessesiScnchrkeyll =ShussineseProcesssreturn ShustinessProcoss:1724172s1724172717281729-1738=1731173%1733 vLUsoriesprivate function getBusinessProcess(string Spipelineid): ?BusinessProcess ..17391730173%private function getBusinessProcessCacheKey(string Spipelineld): string...Z usagesprivate function resolveStage(BusinessProcess $businessProcess, ?string $stageld): ?Stagonivate functsion resolveAnount (annay Sonopentzies): 2stoino!...1lPlaygroundOojiminnyORDER BY SMS COunT DESC031 49 A29 У 3 У 109 A 1SeLen ossNct usid, urenal, u,nane, u,ream io tunane as team nameltwibto sns sid. ttibo nessaoingsFROM users uINNER JOIN teams t 1.n<->1: ON u.tean_id = t.1dWHERE (t.twilio_sns_sid IS NOT NULL OR t.twiLio_nessaging_sid IS NOT NULL)AND u.status = 1nense rynaed orasheSELECT * FROM teans WHERE nane LIKE "XTourhancx"; = 187, 209, 8150, salesforce-adningtSELECICONCAT(u.id, CASE WHEN u.id = t.ownerid THEN " (ouner)' ELSE "* END) AS userid_U.tmostsa.*t.owner id FROM social accounts saJOIN users u on u.id = sa.sociable idJOIN teams t 1..n<->1: on t.id = u.tean icWHERE v.team id = 187 and sa.provider = 'salesforce':select * from activities where id = 31264367select * from contactsseler*"ono0oorUmres whert84045016# update 'activities#'staoe 1d' = 13272set account.zo = 4150032, contace.to = 655163%, opportunzcy.'activities', "uodated at* = 2926-85-22 87:16:17 where 31d* = 3472select * from text nelaus where crested ar > 128720-15-8190select * from acraivustes onder by d descaselect * from usens nhere nane aike " SubraieeSELEM* SROM onnontunitiee WHERE uusd to_bini*84a9c/10-2087-4453-9022-2896678c668000Lselect * from teans where id = 555;select *rom stages where tean.iide S5ssCELECTCONCAT(u.id, CASE WHEN u.id = t.owner id THEN " (ouner)' ELSE ** END) AS user idaomaslsa.*t.owner_id FROM social_accounts saJOIN users u on u.id = sa.sociable idJOIN teams t 1.n<->1: on t.id = u.tean 10WHERE U.team id = 100 and sa.provider = 'hubspot' :Inu cowoy 10.45.1ServiceTestmeesdales Orchancworceoeionhmwesotino ooro+0.cont nuI was deep in the analysis. I've now read PropertyChangeManager completely - it doesn't write 15_von directly. For deal property changes it either does acirect uo update (ory vor oeatnase, descripiion or queues & batch sync via datchsynccolleckorNowthave one tinal anole to chacktthe hedenl stade orointiTity history shous the desi went throuch sthoss saquentisily. But therets somethinc"value": *@.90eeeeeeeeeeeeee *Throuch resol vedea ProbabttrySorobabitty = ors "roreturn 0.9 > 1 2 @ : (int) (0.9 * 100):/1 = (int) (90.0) = 9€Fine. But what about this = the desl was art aeuthientuni* @eodhAdhet• Oanirekielcharwhires2 4 spac...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
3931
|
142
|
5
|
2026-05-07T12:51:24.976519+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778158284976_m2.jpg...
|
iTerm2
|
NULL
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PostmanVIewWindowmelpProiect(C) TranscodeParameter PostmanVIewWindowmelpProiect(C) TranscodeParameterRescl© UserService.php© Uuid.php> D Traits> D UseCases> D User> D Utils› D Validation> OvOphp nelpers.ong© InitialFrontendState.php© Jiminny.php© Plan.php© Serializer.phpC) TeamScimDetails.ohpbootstrap>© build.> contia>D contrib→ database>M docsM front-end>D lang> node_modules library rootM ohostan> M nublic>O resourcesv Mroutesphp api.phpphp api_v2.phppnp console.onopnp customer_api.onppnp embedded.ongpnp nealtn.onppnp scim.onophp uprotectedweb.phpphp web.phpphp webhook.php>O scriptsv O storage> M debuabar.… M frameworkv loasaitianore• audio wav= custom.loal© JiminnyDebugCommand.php X IntegrationApp/.../Syno© HubspotSingleSyncStrategy.php© HandleRateLimit.php© Middleware/RateLimited.php© CachedCrmServiceDecorator.phc(* Hubspot/../Syncd(C) ProviderRateLimiter.phpclass JiminnvDebuaCommand extends Con245349356=hubsnot-iournal-noll.log= laravel logus tht is?Carbon Stolate = null): array 1...}nnivate Function FormatRenontPeripublic function sanitizeFileNameprivate function getPayload(Auton1 usageprivate function rateLimitoSteam = Team:: find(id: 2)scont10 = steam->geturmuont1qScrmResolver = app( abstract: CrinteqratzonAdman' => Ste'providerSlua' => SconfiaScrmService = ScrmResolver->ofonSi=0.S<10 S1++if S1 % 25 === 0)4Sthis->info"SvncinSthis->infold strina: "MScrmService->sync0pportCenmSonvico-smatchRvNamo• SearchYour team is now on the Free plan with 1 admin. You retain editing access and other members are read-only. View team permissions to see who can edit, or upgrade to restore collaborationGET next •POST seatPOST Rea. • POST Rea.GET Rea •GET Rea•GET readGET Get EeGET httosO IterationitereX POST seat •Iteration run Search HS › search contact by email CopyposTntps://api.nubapi.com/crm/vs/objects/contacts/searcn= Docs Params Authorization • Headers 11 Body • Scripts Settingso none torm-data x-www-form-urlencoded raw binary Grapnel JSON v1 { "limit": 1 }Iteratio# Lukas/Stefka 121 - in 1h 39 m100% CNo environmentg Save4*AIVariables in requesG tokenCookies› All variables9 Schema BeautifyThu 7 May 15:51:24UparadeCKPur5PoMxIZOINOMI8kOEw.V COLLECTIONS> CRM Owners> CRM Pipelines› Dealsengagements› OLD ENGAGEMENTSuer list meetingsGET read callGET ist callsPOST meetings scheduledGET det meetinoPost get link to task>POST Create Contact with Association› Hubspotlteration run HSv GET Read Copyeg. An error occurred.se. successful operationv lteration run Search HSPOST search contact by email Copy> Journal & webhoooks v4> ©Auth› Properties> RESCAPCHSEARCHIpost search contact by phonePOST search contact by emailpost coarch meetinas> post Search calle v2POST Search related meetinas v3Post coarch dealsv UicofullGET engagements old associated by dealGET engagements old associated by comoany> GET get history of property - deal stageCaMiDANMeNreSPECS>FLOWS§ Connect GitConcole 5.l TerminsBody Cookies 1 Headers 16 Test Results{} JSON vPreview @ Visualize200 OK • 217 ms • 1.15 KB • (a e.g. Save Response ••: "2018-03-14T14:36:26.401Z",aentunchor Com"2025-10-14110:14:51.517Z,createdAt": "2018-03-14T14:36:26.4017".updatedAt": "2025-10-14T10:14:51.517Z","archived". falce."https://app.hubspot.com/contacts/4392066/record/0-1/1'I,nina" safter", "y"Globals Vault Tools?000...
|
NULL
|
9086126811982739243
|
NULL
|
click
|
ocr
|
NULL
|
PostmanVIewWindowmelpProiect(C) TranscodeParameter PostmanVIewWindowmelpProiect(C) TranscodeParameterRescl© UserService.php© Uuid.php> D Traits> D UseCases> D User> D Utils› D Validation> OvOphp nelpers.ong© InitialFrontendState.php© Jiminny.php© Plan.php© Serializer.phpC) TeamScimDetails.ohpbootstrap>© build.> contia>D contrib→ database>M docsM front-end>D lang> node_modules library rootM ohostan> M nublic>O resourcesv Mroutesphp api.phpphp api_v2.phppnp console.onopnp customer_api.onppnp embedded.ongpnp nealtn.onppnp scim.onophp uprotectedweb.phpphp web.phpphp webhook.php>O scriptsv O storage> M debuabar.… M frameworkv loasaitianore• audio wav= custom.loal© JiminnyDebugCommand.php X IntegrationApp/.../Syno© HubspotSingleSyncStrategy.php© HandleRateLimit.php© Middleware/RateLimited.php© CachedCrmServiceDecorator.phc(* Hubspot/../Syncd(C) ProviderRateLimiter.phpclass JiminnvDebuaCommand extends Con245349356=hubsnot-iournal-noll.log= laravel logus tht is?Carbon Stolate = null): array 1...}nnivate Function FormatRenontPeripublic function sanitizeFileNameprivate function getPayload(Auton1 usageprivate function rateLimitoSteam = Team:: find(id: 2)scont10 = steam->geturmuont1qScrmResolver = app( abstract: CrinteqratzonAdman' => Ste'providerSlua' => SconfiaScrmService = ScrmResolver->ofonSi=0.S<10 S1++if S1 % 25 === 0)4Sthis->info"SvncinSthis->infold strina: "MScrmService->sync0pportCenmSonvico-smatchRvNamo• SearchYour team is now on the Free plan with 1 admin. You retain editing access and other members are read-only. View team permissions to see who can edit, or upgrade to restore collaborationGET next •POST seatPOST Rea. • POST Rea.GET Rea •GET Rea•GET readGET Get EeGET httosO IterationitereX POST seat •Iteration run Search HS › search contact by email CopyposTntps://api.nubapi.com/crm/vs/objects/contacts/searcn= Docs Params Authorization • Headers 11 Body • Scripts Settingso none torm-data x-www-form-urlencoded raw binary Grapnel JSON v1 { "limit": 1 }Iteratio# Lukas/Stefka 121 - in 1h 39 m100% CNo environmentg Save4*AIVariables in requesG tokenCookies› All variables9 Schema BeautifyThu 7 May 15:51:24UparadeCKPur5PoMxIZOINOMI8kOEw.V COLLECTIONS> CRM Owners> CRM Pipelines› Dealsengagements› OLD ENGAGEMENTSuer list meetingsGET read callGET ist callsPOST meetings scheduledGET det meetinoPost get link to task>POST Create Contact with Association› Hubspotlteration run HSv GET Read Copyeg. An error occurred.se. successful operationv lteration run Search HSPOST search contact by email Copy> Journal & webhoooks v4> ©Auth› Properties> RESCAPCHSEARCHIpost search contact by phonePOST search contact by emailpost coarch meetinas> post Search calle v2POST Search related meetinas v3Post coarch dealsv UicofullGET engagements old associated by dealGET engagements old associated by comoany> GET get history of property - deal stageCaMiDANMeNreSPECS>FLOWS§ Connect GitConcole 5.l TerminsBody Cookies 1 Headers 16 Test Results{} JSON vPreview @ Visualize200 OK • 217 ms • 1.15 KB • (a e.g. Save Response ••: "2018-03-14T14:36:26.401Z",aentunchor Com"2025-10-14110:14:51.517Z,createdAt": "2018-03-14T14:36:26.4017".updatedAt": "2025-10-14T10:14:51.517Z","archived". falce."https://app.hubspot.com/contacts/4392066/record/0-1/1'I,nina" safter", "y"Globals Vault Tools?000...
|
3930
|
NULL
|
NULL
|
NULL
|
|
33162
|
1265
|
45
|
2026-05-13T10:07:09.745059+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778666829745_m2.jpg...
|
Firefox
|
[SRD-6848] Sidekick SMS issue - Jira — Work
|
1
|
jiminny.atlassian.net/jira/servicedesk/projects/SR jiminny.atlassian.net/jira/servicedesk/projects/SRD/queues/custom/37/SRD-6848...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidek Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
Close tab
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Dependabot alerts · jiminny/prophet
Dependabot alerts · jiminny/prophet
[JY-19958] Upgrade BE libraries - May - Jira
[JY-19958] Upgrade BE libraries - May - Jira
Findings by vulnerability - Vanta
Findings by vulnerability - Vanta
NVD - cve-2026-33671
NVD - cve-2026-33671
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
jiminny/app/backend-code - Vanta
jiminny/app/backend-code - Vanta
NVD - cve-2026-6722
NVD - cve-2026-6722
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
New Tab
New Tab
Userpilot | Ask Jiminny Report Generated
Userpilot | Ask Jiminny Report Generated
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Close bookmarks (⌘B)
Bookmarks
Bookmarks
Close sidebar
Search bookmarks
Skip to:
Sidebar
Sidebar
Top Bar
Top Bar
Main Content
Main Content
Collapse sidebar [
Collapse sidebar [
Switch sites or apps
Switch sites or apps
Go to your Jira homepage
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
8 Notifications
8 Notifications
Help
Help
Settings
Settings
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Apps
Apps
More actions for Apps
More actions for Apps
Spaces
Spaces
Create space
Create space
More actions for spaces
More actions for spaces
Recent
Service-Desk
Service-Desk
More actions for Service-Desk
More actions for Service-Desk
Queues
Queues
Create
Create
More for queues
More for queues
Team Priority
Team Priority
All open tickets
All open tickets
Star All open tickets
9
Unassigned tickets
Unassigned tickets
Star Unassigned tickets
1
Support team Queue
Support team Queue
Star Support team Queue
5
Raised by me
Raised by me
Star Raised by me
0
Assigned to me
Assigned to me
Star Assigned to me
1
Service requests
Service requests
Star Service requests
4
Platform team
Platform team
Star Platform team
1
Processing team
Processing team
Star Processing team
4
Site reliability team
Site reliability team
Star Site reliability team
0
New features requests
New features requests...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Usage | Windsurf","depth":4,"bounds":{"left":0.0,"top":0.0518755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Usage | Windsurf","depth":5,"bounds":{"left":0.013297873,"top":0.06304868,"width":0.029920213,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":4,"bounds":{"left":0.0,"top":0.08459697,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.09577015,"width":0.06632314,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.09177973,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0,"top":0.11731844,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.12849163,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Dependabot alerts · jiminny/prophet","depth":4,"bounds":{"left":0.0,"top":0.15003991,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Dependabot alerts · jiminny/prophet","depth":5,"bounds":{"left":0.013297873,"top":0.16121309,"width":0.06216755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-19958] Upgrade BE libraries - May - Jira","depth":4,"bounds":{"left":0.0,"top":0.18276137,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-19958] Upgrade BE libraries - May - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.19393456,"width":0.07762633,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Findings by vulnerability - Vanta","depth":4,"bounds":{"left":0.0,"top":0.21548285,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Findings by vulnerability - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.22665602,"width":0.055851065,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-33671","depth":4,"bounds":{"left":0.0,"top":0.2482043,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-33671","depth":5,"bounds":{"left":0.013297873,"top":0.25937748,"width":0.041223403,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.28092578,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.29209897,"width":0.13680187,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"jiminny/app/backend-code - Vanta","depth":4,"bounds":{"left":0.0,"top":0.31364724,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny/app/backend-code - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.32482043,"width":0.059674203,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-6722","depth":4,"bounds":{"left":0.0,"top":0.3463687,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-6722","depth":5,"bounds":{"left":0.013297873,"top":0.3575419,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"bounds":{"left":0.0,"top":0.3790902,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.39026338,"width":0.1200133,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.41181165,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.42298484,"width":0.20977394,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":4,"bounds":{"left":0.0,"top":0.4445331,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":5,"bounds":{"left":0.013297873,"top":0.4557063,"width":0.40475398,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.0,"top":0.4772546,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.013297873,"top":0.4884278,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Userpilot | Ask Jiminny Report Generated","depth":4,"bounds":{"left":0.0,"top":0.509976,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Userpilot | Ask Jiminny Report Generated","depth":5,"bounds":{"left":0.013297873,"top":0.5211492,"width":0.07164229,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":4,"bounds":{"left":0.0,"top":0.54269755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.55387074,"width":0.06632314,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-19957] Upgrade BE libraries - Apr - Jira","depth":4,"bounds":{"left":0.0,"top":0.575419,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-19957] Upgrade BE libraries - Apr - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.5865922,"width":0.076296546,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.60814047,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.61931366,"width":0.20977394,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.6408619,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.6520351,"width":0.13796543,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.6735834,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.6847566,"width":0.14378324,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.70630485,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.71747804,"width":0.13680187,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.7406225,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Bookmarks","depth":5,"bounds":{"left":0.083277926,"top":0.06943336,"width":0.026761968,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bookmarks","depth":6,"bounds":{"left":0.083277926,"top":0.06943336,"width":0.026761968,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close sidebar","depth":6,"bounds":{"left":0.16938165,"top":0.06424581,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Search bookmarks","depth":7,"bounds":{"left":0.082446806,"top":0.09976058,"width":0.09857048,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to:","depth":9,"bounds":{"left":0.19714096,"top":0.07861133,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Sidebar","depth":10,"bounds":{"left":0.19714096,"top":0.097765364,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sidebar","depth":11,"bounds":{"left":0.19714096,"top":0.097765364,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Top Bar","depth":10,"bounds":{"left":0.19714096,"top":0.11691939,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Top Bar","depth":11,"bounds":{"left":0.19714096,"top":0.11691939,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Main Content","depth":10,"bounds":{"left":0.19714096,"top":0.13607343,"width":0.029421542,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Main Content","depth":11,"bounds":{"left":0.19714096,"top":0.13607343,"width":0.029421542,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse sidebar [","depth":9,"bounds":{"left":0.19049202,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse sidebar [","depth":11,"bounds":{"left":0.19564494,"top":0.06344773,"width":0.039727394,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Switch sites or apps","depth":10,"bounds":{"left":0.20246011,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Switch sites or apps","depth":12,"bounds":{"left":0.20761304,"top":0.06344773,"width":0.044215426,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Go to your Jira homepage","depth":9,"bounds":{"left":0.21575798,"top":0.057861134,"width":0.029421542,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Search, press enter to navigate to advanced search with your text query","depth":11,"bounds":{"left":0.4582779,"top":0.06264964,"width":0.24268617,"height":0.015961692},"on_screen":true,"help_text":"","placeholder":"Search","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Create","depth":10,"bounds":{"left":0.70927525,"top":0.057861134,"width":0.030086435,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create","depth":12,"bounds":{"left":0.72057843,"top":0.06384677,"width":0.014793883,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Rovo Ask Rovo","depth":12,"bounds":{"left":0.91240025,"top":0.057861134,"width":0.035904255,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Rovo","depth":14,"bounds":{"left":0.92370343,"top":0.06384677,"width":0.020611702,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"8 Notifications","depth":12,"bounds":{"left":0.9496343,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"8 Notifications","depth":14,"bounds":{"left":0.95478725,"top":0.06344773,"width":0.031914894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Help","depth":12,"bounds":{"left":0.9616024,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Help","depth":14,"bounds":{"left":0.96675533,"top":0.06344773,"width":0.010139627,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Settings","depth":12,"bounds":{"left":0.97357047,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Settings","depth":14,"bounds":{"left":0.9787234,"top":0.06344773,"width":0.017952127,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"lukas.kovalik@jiminny.com","depth":12,"bounds":{"left":0.98553854,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"lukas.kovalik@jiminny.com","depth":14,"bounds":{"left":0.9906915,"top":0.06344773,"width":0.009308517,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"For you","depth":12,"bounds":{"left":0.19049202,"top":0.09976058,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"For you","depth":15,"bounds":{"left":0.20113032,"top":0.10574621,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Recent","depth":12,"bounds":{"left":0.19049202,"top":0.12529927,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Recent","depth":15,"bounds":{"left":0.20113032,"top":0.13128492,"width":0.015458777,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Starred","depth":12,"bounds":{"left":0.19049202,"top":0.15083799,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Starred","depth":15,"bounds":{"left":0.20113032,"top":0.15682362,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Apps","depth":12,"bounds":{"left":0.19049202,"top":0.1763767,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Apps","depth":15,"bounds":{"left":0.20113032,"top":0.18236233,"width":0.011635638,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for Apps","depth":13,"bounds":{"left":0.2599734,"top":0.17956904,"width":0.0039893617,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for Apps","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Spaces","depth":12,"bounds":{"left":0.19049202,"top":0.2019154,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Spaces","depth":15,"bounds":{"left":0.20113032,"top":0.20790103,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Create space","depth":13,"bounds":{"left":0.24335106,"top":0.20510775,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create space","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for spaces","depth":13,"bounds":{"left":0.2526596,"top":0.20510775,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for spaces","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Recent","depth":16,"bounds":{"left":0.19647606,"top":0.23423783,"width":0.013464096,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Service-Desk","depth":17,"bounds":{"left":0.19448139,"top":0.2529928,"width":0.0674867,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Service-Desk","depth":20,"bounds":{"left":0.20511968,"top":0.25897846,"width":0.03025266,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for Service-Desk","depth":18,"bounds":{"left":0.2526596,"top":0.25618514,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for Service-Desk","depth":20,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Queues","depth":21,"bounds":{"left":0.19847074,"top":0.27853152,"width":0.06349734,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Queues","depth":24,"bounds":{"left":0.20910904,"top":0.28451717,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Create","depth":22,"bounds":{"left":0.24335106,"top":0.28172386,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Create","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More for queues","depth":22,"bounds":{"left":0.2526596,"top":0.28172386,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More for queues","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Team Priority","depth":23,"bounds":{"left":0.20246011,"top":0.30407023,"width":0.059507977,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Team Priority","depth":26,"bounds":{"left":0.2130984,"top":0.31005585,"width":0.029587766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"All open tickets","depth":25,"bounds":{"left":0.20644946,"top":0.32960895,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All open tickets","depth":28,"bounds":{"left":0.21708776,"top":0.33559456,"width":0.034075797,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star All open tickets","depth":26,"bounds":{"left":0.2526596,"top":0.33280128,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"9","depth":28,"bounds":{"left":0.2554854,"top":0.33719075,"width":0.0023271276,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Unassigned tickets","depth":25,"bounds":{"left":0.20644946,"top":0.35514766,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Unassigned tickets","depth":28,"bounds":{"left":0.21708776,"top":0.36113328,"width":0.03307846,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Unassigned tickets","depth":26,"bounds":{"left":0.2526596,"top":0.35834,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":28,"bounds":{"left":0.25581783,"top":0.36272946,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Support team Queue","depth":25,"bounds":{"left":0.20644946,"top":0.38068634,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Support team Queue","depth":28,"bounds":{"left":0.21708776,"top":0.386672,"width":0.03025266,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Support team Queue","depth":26,"bounds":{"left":0.2526596,"top":0.38387868,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"5","depth":28,"bounds":{"left":0.2554854,"top":0.38826814,"width":0.0023271276,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Raised by me","depth":25,"bounds":{"left":0.20644946,"top":0.40622506,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Raised by me","depth":28,"bounds":{"left":0.21708776,"top":0.4122107,"width":0.029753989,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Raised by me","depth":26,"bounds":{"left":0.2526596,"top":0.4094174,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":28,"bounds":{"left":0.25531915,"top":0.41380686,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Assigned to me","depth":25,"bounds":{"left":0.20644946,"top":0.43176377,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Assigned to me","depth":28,"bounds":{"left":0.21708776,"top":0.43774942,"width":0.03174867,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Assigned to me","depth":26,"bounds":{"left":0.2526596,"top":0.4349561,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":28,"bounds":{"left":0.25581783,"top":0.43934557,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Service requests","depth":25,"bounds":{"left":0.20644946,"top":0.45730248,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Service requests","depth":28,"bounds":{"left":0.21708776,"top":0.4632881,"width":0.033410903,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Service requests","depth":26,"bounds":{"left":0.2526596,"top":0.46049482,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4","depth":28,"bounds":{"left":0.25531915,"top":0.46488428,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Platform team","depth":25,"bounds":{"left":0.20644946,"top":0.4828412,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform team","depth":28,"bounds":{"left":0.21708776,"top":0.4888268,"width":0.031083776,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Platform team","depth":26,"bounds":{"left":0.2526596,"top":0.48603353,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":28,"bounds":{"left":0.25581783,"top":0.490423,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Processing team","depth":25,"bounds":{"left":0.20644946,"top":0.5083799,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Processing team","depth":28,"bounds":{"left":0.21708776,"top":0.5143655,"width":0.03307846,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Processing team","depth":26,"bounds":{"left":0.2526596,"top":0.51157224,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4","depth":28,"bounds":{"left":0.25531915,"top":0.5159617,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Site reliability team","depth":25,"bounds":{"left":0.20644946,"top":0.5339186,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Site reliability team","depth":28,"bounds":{"left":0.21708776,"top":0.53990424,"width":0.03274601,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Site reliability team","depth":26,"bounds":{"left":0.2526596,"top":0.5371109,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":28,"bounds":{"left":0.25531915,"top":0.5415004,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"New features requests","depth":25,"bounds":{"left":0.20644946,"top":0.5594573,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New features requests","depth":28,"bounds":{"left":0.21708776,"top":0.5654429,"width":0.032579787,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9085723538917007995
|
-342385921216889834
|
visual_change
|
accessibility
|
NULL
|
Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidek Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
Close tab
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Dependabot alerts · jiminny/prophet
Dependabot alerts · jiminny/prophet
[JY-19958] Upgrade BE libraries - May - Jira
[JY-19958] Upgrade BE libraries - May - Jira
Findings by vulnerability - Vanta
Findings by vulnerability - Vanta
NVD - cve-2026-33671
NVD - cve-2026-33671
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
jiminny/app/backend-code - Vanta
jiminny/app/backend-code - Vanta
NVD - cve-2026-6722
NVD - cve-2026-6722
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
New Tab
New Tab
Userpilot | Ask Jiminny Report Generated
Userpilot | Ask Jiminny Report Generated
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Close bookmarks (⌘B)
Bookmarks
Bookmarks
Close sidebar
Search bookmarks
Skip to:
Sidebar
Sidebar
Top Bar
Top Bar
Main Content
Main Content
Collapse sidebar [
Collapse sidebar [
Switch sites or apps
Switch sites or apps
Go to your Jira homepage
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
8 Notifications
8 Notifications
Help
Help
Settings
Settings
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Apps
Apps
More actions for Apps
More actions for Apps
Spaces
Spaces
Create space
Create space
More actions for spaces
More actions for spaces
Recent
Service-Desk
Service-Desk
More actions for Service-Desk
More actions for Service-Desk
Queues
Queues
Create
Create
More for queues
More for queues
Team Priority
Team Priority
All open tickets
All open tickets
Star All open tickets
9
Unassigned tickets
Unassigned tickets
Star Unassigned tickets
1
Support team Queue
Support team Queue
Star Support team Queue
5
Raised by me
Raised by me
Star Raised by me
0
Assigned to me
Assigned to me
Star Assigned to me
1
Service requests
Service requests
Star Service requests
4
Platform team
Platform team
Star Platform team
1
Processing team
Processing team
Star Processing team
4
Site reliability team
Site reliability team
Star Site reliability team
0
New features requests
New features requests...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
33232
|
1267
|
25
|
2026-05-13T10:10:25.051400+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-13/1778 /Users/lukas/.screenpipe/data/data/2026-05-13/1778667025051_m2.jpg...
|
Firefox
|
[SRD-6848] Sidekick SMS issue - Jira — Work
|
1
|
jiminny.atlassian.net/jira/servicedesk/projects/SR jiminny.atlassian.net/jira/servicedesk/projects/SRD/queues/custom/37/SRD-6848...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidek Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
Close tab
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Dependabot alerts · jiminny/prophet
Dependabot alerts · jiminny/prophet
[JY-19958] Upgrade BE libraries - May - Jira
[JY-19958] Upgrade BE libraries - May - Jira
Findings by vulnerability - Vanta
Findings by vulnerability - Vanta
NVD - cve-2026-33671
NVD - cve-2026-33671
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
jiminny/app/backend-code - Vanta
jiminny/app/backend-code - Vanta
NVD - cve-2026-6722
NVD - cve-2026-6722
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
New Tab
New Tab
Userpilot | Ask Jiminny Report Generated
Userpilot | Ask Jiminny Report Generated
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Close bookmarks (⌘B)
Bookmarks
Bookmarks
Close sidebar
Search bookmarks
Skip to:
Sidebar
Sidebar
Top Bar
Top Bar
Main Content
Main Content
Collapse sidebar [
Collapse sidebar [
Switch sites or apps
Switch sites or apps
Go to your Jira homepage
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
8 Notifications
8 Notifications
Help
Help
Settings
Settings
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Apps
Apps
More actions for Apps
More actions for Apps
Spaces
Spaces
Create space
Create space
More actions for spaces
More actions for spaces
Recent
Service-Desk
Service-Desk
More actions for Service-Desk
More actions for Service-Desk
Queues
Queues
Create
Create
More for queues
More for queues
Team Priority
Team Priority
All open tickets
All open tickets
Star All open tickets
9
Unassigned tickets
Unassigned tickets
Star Unassigned tickets
1
Support team Queue
Support team Queue
Star Support team Queue
5
Raised by me
Raised by me
Star Raised by me
0
Assigned to me
Assigned to me
Star Assigned to me
1
Service requests
Service requests
Star Service requests
4
Platform team
Platform team
Star Platform team
1
Processing team
Processing team
Star Processing team
4
Site reliability team
Site reliability team
Star Site reliability team
0
New features requests
New features requests...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Usage | Windsurf","depth":4,"bounds":{"left":0.0,"top":0.0518755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Usage | Windsurf","depth":5,"bounds":{"left":0.013297873,"top":0.06304868,"width":0.029920213,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":4,"bounds":{"left":0.0,"top":0.08459697,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.09577015,"width":0.06632314,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.09177973,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0,"top":0.11731844,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.12849163,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Dependabot alerts · jiminny/prophet","depth":4,"bounds":{"left":0.0,"top":0.15003991,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Dependabot alerts · jiminny/prophet","depth":5,"bounds":{"left":0.013297873,"top":0.16121309,"width":0.06216755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-19958] Upgrade BE libraries - May - Jira","depth":4,"bounds":{"left":0.0,"top":0.18276137,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-19958] Upgrade BE libraries - May - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.19393456,"width":0.07762633,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Findings by vulnerability - Vanta","depth":4,"bounds":{"left":0.0,"top":0.21548285,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Findings by vulnerability - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.22665602,"width":0.055851065,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-33671","depth":4,"bounds":{"left":0.0,"top":0.2482043,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-33671","depth":5,"bounds":{"left":0.013297873,"top":0.25937748,"width":0.041223403,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.28092578,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.29209897,"width":0.13680187,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"jiminny/app/backend-code - Vanta","depth":4,"bounds":{"left":0.0,"top":0.31364724,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny/app/backend-code - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.32482043,"width":0.059674203,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-6722","depth":4,"bounds":{"left":0.0,"top":0.3463687,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-6722","depth":5,"bounds":{"left":0.013297873,"top":0.3575419,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":4,"bounds":{"left":0.0,"top":0.3790902,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20773] User Pilot not receiving events on report generated - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.39026338,"width":0.1200133,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.41181165,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.42298484,"width":0.20977394,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":4,"bounds":{"left":0.0,"top":0.4445331,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: League\\Flysystem\\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app","depth":5,"bounds":{"left":0.013297873,"top":0.4557063,"width":0.40475398,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.0,"top":0.4772546,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.013297873,"top":0.4884278,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Userpilot | Ask Jiminny Report Generated","depth":4,"bounds":{"left":0.0,"top":0.509976,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Userpilot | Ask Jiminny Report Generated","depth":5,"bounds":{"left":0.013297873,"top":0.5211492,"width":0.07164229,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":4,"bounds":{"left":0.0,"top":0.54269755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6848] Sidekick SMS issue - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.55387074,"width":0.06632314,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-19957] Upgrade BE libraries - Apr - Jira","depth":4,"bounds":{"left":0.0,"top":0.575419,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-19957] Upgrade BE libraries - Apr - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.5865922,"width":0.076296546,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.60814047,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.61931366,"width":0.20977394,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.6408619,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.6520351,"width":0.13796543,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.6735834,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.6847566,"width":0.14378324,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"bounds":{"left":0.0,"top":0.70630485,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"bounds":{"left":0.013297873,"top":0.71747804,"width":0.13680187,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.7406225,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Bookmarks","depth":5,"bounds":{"left":0.083277926,"top":0.06943336,"width":0.026761968,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bookmarks","depth":6,"bounds":{"left":0.083277926,"top":0.06943336,"width":0.026761968,"height":0.014764565},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close sidebar","depth":6,"bounds":{"left":0.16938165,"top":0.06424581,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Search bookmarks","depth":7,"bounds":{"left":0.082446806,"top":0.09976058,"width":0.09857048,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to:","depth":9,"bounds":{"left":0.19714096,"top":0.07861133,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Sidebar","depth":10,"bounds":{"left":0.19714096,"top":0.097765364,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sidebar","depth":11,"bounds":{"left":0.19714096,"top":0.097765364,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Top Bar","depth":10,"bounds":{"left":0.19714096,"top":0.11691939,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Top Bar","depth":11,"bounds":{"left":0.19714096,"top":0.11691939,"width":0.016954787,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Main Content","depth":10,"bounds":{"left":0.19714096,"top":0.13607343,"width":0.029421542,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Main Content","depth":11,"bounds":{"left":0.19714096,"top":0.13607343,"width":0.029421542,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse sidebar [","depth":9,"bounds":{"left":0.19049202,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse sidebar [","depth":11,"bounds":{"left":0.19564494,"top":0.06344773,"width":0.039727394,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Switch sites or apps","depth":10,"bounds":{"left":0.20246011,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Switch sites or apps","depth":12,"bounds":{"left":0.20761304,"top":0.06344773,"width":0.044215426,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Go to your Jira homepage","depth":9,"bounds":{"left":0.21575798,"top":0.057861134,"width":0.029421542,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Search, press enter to navigate to advanced search with your text query","depth":11,"bounds":{"left":0.4582779,"top":0.06264964,"width":0.24268617,"height":0.015961692},"on_screen":true,"help_text":"","placeholder":"Search","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Create","depth":10,"bounds":{"left":0.70927525,"top":0.057861134,"width":0.030086435,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create","depth":12,"bounds":{"left":0.72057843,"top":0.06384677,"width":0.014793883,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Rovo Ask Rovo","depth":12,"bounds":{"left":0.91240025,"top":0.057861134,"width":0.035904255,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Rovo","depth":14,"bounds":{"left":0.92370343,"top":0.06384677,"width":0.020611702,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"8 Notifications","depth":12,"bounds":{"left":0.9496343,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"8 Notifications","depth":14,"bounds":{"left":0.95478725,"top":0.06344773,"width":0.031914894,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Help","depth":12,"bounds":{"left":0.9616024,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Help","depth":14,"bounds":{"left":0.96675533,"top":0.06344773,"width":0.010139627,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Settings","depth":12,"bounds":{"left":0.97357047,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Settings","depth":14,"bounds":{"left":0.9787234,"top":0.06344773,"width":0.017952127,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"lukas.kovalik@jiminny.com","depth":12,"bounds":{"left":0.98553854,"top":0.057861134,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"lukas.kovalik@jiminny.com","depth":14,"bounds":{"left":0.9906915,"top":0.06344773,"width":0.009308517,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"For you","depth":12,"bounds":{"left":0.19049202,"top":0.09976058,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"For you","depth":15,"bounds":{"left":0.20113032,"top":0.10574621,"width":0.01662234,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Recent","depth":12,"bounds":{"left":0.19049202,"top":0.12529927,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Recent","depth":15,"bounds":{"left":0.20113032,"top":0.13128492,"width":0.015458777,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Starred","depth":12,"bounds":{"left":0.19049202,"top":0.15083799,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Starred","depth":15,"bounds":{"left":0.20113032,"top":0.15682362,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Apps","depth":12,"bounds":{"left":0.19049202,"top":0.1763767,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Apps","depth":15,"bounds":{"left":0.20113032,"top":0.18236233,"width":0.011635638,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for Apps","depth":13,"bounds":{"left":0.2599734,"top":0.17956904,"width":0.0039893617,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for Apps","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Spaces","depth":12,"bounds":{"left":0.19049202,"top":0.2019154,"width":0.071476065,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Spaces","depth":15,"bounds":{"left":0.20113032,"top":0.20790103,"width":0.016456118,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Create space","depth":13,"bounds":{"left":0.24335106,"top":0.20510775,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create space","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for spaces","depth":13,"bounds":{"left":0.2526596,"top":0.20510775,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for spaces","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Recent","depth":16,"bounds":{"left":0.19647606,"top":0.23423783,"width":0.013464096,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Service-Desk","depth":17,"bounds":{"left":0.19448139,"top":0.2529928,"width":0.0674867,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Service-Desk","depth":20,"bounds":{"left":0.20511968,"top":0.25897846,"width":0.03025266,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More actions for Service-Desk","depth":18,"bounds":{"left":0.2526596,"top":0.25618514,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions for Service-Desk","depth":20,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Queues","depth":21,"bounds":{"left":0.19847074,"top":0.27853152,"width":0.06349734,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Queues","depth":24,"bounds":{"left":0.20910904,"top":0.28451717,"width":0.017121011,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Create","depth":22,"bounds":{"left":0.24335106,"top":0.28172386,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Create","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"More for queues","depth":22,"bounds":{"left":0.2526596,"top":0.28172386,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More for queues","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Team Priority","depth":23,"bounds":{"left":0.20246011,"top":0.30407023,"width":0.059507977,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"Team Priority","depth":26,"bounds":{"left":0.2130984,"top":0.31005585,"width":0.029587766,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"All open tickets","depth":25,"bounds":{"left":0.20644946,"top":0.32960895,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"All open tickets","depth":28,"bounds":{"left":0.21708776,"top":0.33559456,"width":0.034075797,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star All open tickets","depth":26,"bounds":{"left":0.2526596,"top":0.33280128,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"9","depth":28,"bounds":{"left":0.2554854,"top":0.33719075,"width":0.0023271276,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Unassigned tickets","depth":25,"bounds":{"left":0.20644946,"top":0.35514766,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Unassigned tickets","depth":28,"bounds":{"left":0.21708776,"top":0.36113328,"width":0.03307846,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Unassigned tickets","depth":26,"bounds":{"left":0.2526596,"top":0.35834,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":28,"bounds":{"left":0.25581783,"top":0.36272946,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Support team Queue","depth":25,"bounds":{"left":0.20644946,"top":0.38068634,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Support team Queue","depth":28,"bounds":{"left":0.21708776,"top":0.386672,"width":0.03025266,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Support team Queue","depth":26,"bounds":{"left":0.2526596,"top":0.38387868,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"5","depth":28,"bounds":{"left":0.2554854,"top":0.38826814,"width":0.0023271276,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Raised by me","depth":25,"bounds":{"left":0.20644946,"top":0.40622506,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Raised by me","depth":28,"bounds":{"left":0.21708776,"top":0.4122107,"width":0.029753989,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Raised by me","depth":26,"bounds":{"left":0.2526596,"top":0.4094174,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":28,"bounds":{"left":0.25531915,"top":0.41380686,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Assigned to me","depth":25,"bounds":{"left":0.20644946,"top":0.43176377,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Assigned to me","depth":28,"bounds":{"left":0.21708776,"top":0.43774942,"width":0.03174867,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Assigned to me","depth":26,"bounds":{"left":0.2526596,"top":0.4349561,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":28,"bounds":{"left":0.25581783,"top":0.43934557,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Service requests","depth":25,"bounds":{"left":0.20644946,"top":0.45730248,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Service requests","depth":28,"bounds":{"left":0.21708776,"top":0.4632881,"width":0.033410903,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Service requests","depth":26,"bounds":{"left":0.2526596,"top":0.46049482,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4","depth":28,"bounds":{"left":0.25531915,"top":0.46488428,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Platform team","depth":25,"bounds":{"left":0.20644946,"top":0.4828412,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform team","depth":28,"bounds":{"left":0.21708776,"top":0.4888268,"width":0.031083776,"height":0.01396648},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Platform team","depth":26,"bounds":{"left":0.2526596,"top":0.48603353,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"1","depth":28,"bounds":{"left":0.25581783,"top":0.490423,"width":0.0016622341,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Processing team","depth":25,"bounds":{"left":0.20644946,"top":0.5083799,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Processing team","depth":28,"bounds":{"left":0.21708776,"top":0.5143655,"width":0.03307846,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Processing team","depth":26,"bounds":{"left":0.2526596,"top":0.51157224,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"4","depth":28,"bounds":{"left":0.25531915,"top":0.5159617,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Site reliability team","depth":25,"bounds":{"left":0.20644946,"top":0.5339186,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Site reliability team","depth":28,"bounds":{"left":0.21708776,"top":0.53990424,"width":0.03274601,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Star Site reliability team","depth":26,"bounds":{"left":0.2526596,"top":0.5371109,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0","depth":28,"bounds":{"left":0.25531915,"top":0.5415004,"width":0.0026595744,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"New features requests","depth":25,"bounds":{"left":0.20644946,"top":0.5594573,"width":0.055518616,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New features requests","depth":28,"bounds":{"left":0.21708776,"top":0.5654429,"width":0.032579787,"height":0.029928172},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9085723538917007995
|
-342385921216889834
|
visual_change
|
accessibility
|
NULL
|
Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidek Usage | Windsurf
Usage | Windsurf
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
Close tab
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 4 Q2 - Platform Team - Scrum Board - Jira
Dependabot alerts · jiminny/prophet
Dependabot alerts · jiminny/prophet
[JY-19958] Upgrade BE libraries - May - Jira
[JY-19958] Upgrade BE libraries - May - Jira
Findings by vulnerability - Vanta
Findings by vulnerability - Vanta
NVD - cve-2026-33671
NVD - cve-2026-33671
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
jiminny/app/backend-code - Vanta
jiminny/app/backend-code - Vanta
NVD - cve-2026-6722
NVD - cve-2026-6722
[JY-20773] User Pilot not receiving events on report generated - Jira
[JY-20773] User Pilot not receiving events on report generated - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
TypeError: League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given, called in /home/jiminny/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 218 — jiminny — app
New Tab
New Tab
Userpilot | Ask Jiminny Report Generated
Userpilot | Ask Jiminny Report Generated
[SRD-6848] Sidekick SMS issue - Jira
[SRD-6848] Sidekick SMS issue - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
[JY-19957] Upgrade BE libraries - Apr - Jira
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
JY-19957 | Remove abanded sympfony debug, compose upgrade by nikolaybiaivanov · Pull Request #12022 · jiminny/app
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Close bookmarks (⌘B)
Bookmarks
Bookmarks
Close sidebar
Search bookmarks
Skip to:
Sidebar
Sidebar
Top Bar
Top Bar
Main Content
Main Content
Collapse sidebar [
Collapse sidebar [
Switch sites or apps
Switch sites or apps
Go to your Jira homepage
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
8 Notifications
8 Notifications
Help
Help
Settings
Settings
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Apps
Apps
More actions for Apps
More actions for Apps
Spaces
Spaces
Create space
Create space
More actions for spaces
More actions for spaces
Recent
Service-Desk
Service-Desk
More actions for Service-Desk
More actions for Service-Desk
Queues
Queues
Create
Create
More for queues
More for queues
Team Priority
Team Priority
All open tickets
All open tickets
Star All open tickets
9
Unassigned tickets
Unassigned tickets
Star Unassigned tickets
1
Support team Queue
Support team Queue
Star Support team Queue
5
Raised by me
Raised by me
Star Raised by me
0
Assigned to me
Assigned to me
Star Assigned to me
1
Service requests
Service requests
Star Service requests
4
Platform team
Platform team
Star Platform team
1
Processing team
Processing team
Star Processing team
4
Site reliability team
Site reliability team
Star Site reliability team
0
New features requests
New features requests...
|
33229
|
NULL
|
NULL
|
NULL
|
|
621
|
23
|
27
|
2026-05-07T07:20:34.200439+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778138434200_m1.jpg...
|
Firefox
|
Moje predplatné | Denník N — Personal
|
1
|
predplatne.dennikn.sk/subscriptions/subscriptions/ predplatne.dennikn.sk/subscriptions/subscriptions/my...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
Home | Hostinger
Home | Hostinger
Login – Nginx Proxy Manager
Login – Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
Moje predplatné | Denník N
Moje predplatné | Denník N
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Preskočiť hlavnú navigáciu
Preskočiť hlavnú navigáciu
Denník N
Denník N
Denník N
[EMAIL]
[EMAIL]
Predplatné
Predplatné
Platby
Platby
Newslettre
Newslettre
Témy a autori
Témy a autori
Adresa, faktúry
Adresa, faktúry
Nastavenia
Nastavenia
Odhlásiť
Odhlásiť
Predĺžiť predplatné
Predĺžiť predplatné
Zmeniť predplatné / Upgrade
Zmeniť predplatné / Upgrade
História predplatných
História predplatných
Predplatné
Od
Do
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / 4 týždne za 7,99 EUR
7. mája 2026, 17:59:50
4. júna 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / 4 týždne za 7,99 EUR
9. apríla 2026, 17:59:50
Aktuálne
7. mája 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / 4 týždne za 7,99 EUR
12. marca 2026, 17:59:50
9. apríla 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandard predplatné na 4 týždne za polovičnú cenu
12. februára 2026, 17:59:50
12. marca 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandard predplatné na 4 týždne za polovičnú cenu
15. januára 2026, 17:59:50
12. februára 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandard predplatné na 4 týždne za polovičnú cenu
18. decembra 2025, 17:59:50
15. januára 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Akciové štandard predplatné N 2025 / 12 týždňov za 1,00 EUR
25. septembra 2025, 17:59:50
18. decembra 2025, 17:59:50
Web
Štandard
Mobilné aplikácie
Týždeň
Štandard Denník N a .týždeň 1 mesiac (v3)
15. mája 2025, 19:52:30
15. júna 2025, 19:52:30
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac za 7,99 (inapp platba)
23. februára 2025, 6:36:33
23. marca 2025, 5:36:25
Web
Bonusové dvojdňové predplatné
2. augusta 2024, 23:02:05
4. augusta 2024, 23:02:05
Web
Mini N / 6 mesiacov so 6 € trial zľavou (Subscribe with Google)
2. februára 2024, 22:02:39
2. augusta 2024, 23:01:52
Web
Webové mini predplatné N / 4 týždne za 5,99 EUR
2. októbra 2023, 18:47:41
30. októbra 2023, 18:47:41
Web
Webové mini predplatné N / 4 týždne za 5,99 EUR
22. júna 2023, 17:21:19
20. júla 2023, 17:21:19
Web
Bonusové dvojdňové predplatné
18. apríla 2023, 16:51:04
20. apríla 2023, 16:51:04
Web
Webové mini predplatné N / rok za 47,90 EUR
18. apríla 2022, 16:50:06
18. apríla 2023, 16:50:06
Web
Webové mini predplatné N / 4 týždne
21. marca 2022, 16:50:06
18. apríla 2022, 16:50:06
Web
Webové mini predplatné N / 4 týždne
19. februára 2022, 21:59:22
19. marca 2022, 21:59:22
Web
Webové mini predplatné N / 4 týždne
3. januára 2022, 10:46:12
31. januára 2022, 10:46:12
Web
Webové mini predplatné N / 4 týždne
3. decembra 2021, 16:12:07
31. decembra 2021, 16:12:07
Web
Webové mini predplatné N / mesiac
29. októbra 2021, 6:47:26
29. novembra 2021, 6:47:26
Web
Webové mini predplatné N / mesiac
1. augusta 2021, 8:51:45
1. septembra 2021, 8:51:45
Web
Webové mini predplatné N / mesiac
24. júna 2021, 9:26:56
25. júla 2021, 9:26:56
Web
Webové mini predplatné N / mesiac
23. mája 2021, 7:32:29
23. júna 2021, 7:32:29
Web
Webové mini predplatné N / mesiac
15. apríla 2021, 8:53:25
16. mája 2021, 8:53:25
Web
Webové mini predplatné N / mesiac
15. marca 2021, 8:53:25
15. apríla 2021, 8:53:25
Web
Webové mini predplatné N / mesiac
8. februára 2021, 4:12:51
11. marca 2021, 4:12:51
Web
Webové mini predplatné N / mesiac
8. januára 2021, 4:12:51
8. februára 2021, 4:12:51
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac
16. septembra 2020, 13:18:28
17. októbra 2020, 13:18:28
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac
16. augusta 2020, 8:37:44
16. septembra 2020, 8:37:44
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac
11. júna 2020, 6:49:27
12. júla 2020, 6:49:27
Web
Týždeň
Mesačné predplatné dennikn.sk a tyzden.sk
30. marca 2020, 13:07:55
29. apríla 2020, 13:07:55
Web
Týždeň
Mesačné predplatné dennikn.sk a tyzden.sk
28. februára 2020, 13:07:55
30. marca 2020, 13:07:55...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pull requests · screenpipe/screenpipe · GitHub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Home | Hostinger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Home | Hostinger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Login – Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Login – Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: archive.db","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: archive.db","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SQLite Web: db.sqlite","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SQLite Web: db.sqlite","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Moje predplatné | Denník N","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Moje predplatné | Denník N","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Preskočiť hlavnú navigáciu","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Preskočiť hlavnú navigáciu","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Denník N","depth":8,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"Denník N","depth":9,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Denník N","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"kovaliklukas@gmail.com","depth":8,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"kovaliklukas@gmail.com","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Predplatné","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Predplatné","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Platby","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platby","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Newslettre","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Newslettre","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Témy a autori","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Témy a autori","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Adresa, faktúry","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Adresa, faktúry","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Nastavenia","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nastavenia","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Odhlásiť","depth":10,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Odhlásiť","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":" Predĺžiť predplatné","depth":11,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Predĺžiť predplatné","depth":12,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":" Zmeniť predplatné / Upgrade","depth":11,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Zmeniť predplatné / Upgrade","depth":12,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"História predplatných","depth":8,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"História predplatných","depth":9,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Predplatné","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Od","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Do","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / 4 týždne za 7,99 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"7. mája 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. júna 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / 4 týždne za 7,99 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"9. apríla 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Aktuálne","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"7. mája 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / 4 týždne za 7,99 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12. marca 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"9. apríla 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard predplatné na 4 týždne za polovičnú cenu","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12. februára 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12. marca 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard predplatné na 4 týždne za polovičnú cenu","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. januára 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12. februára 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard predplatné na 4 týždne za polovičnú cenu","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"18. decembra 2025, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. januára 2026, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Akciové štandard predplatné N 2025 / 12 týždňov za 1,00 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"25. septembra 2025, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"18. decembra 2025, 17:59:50","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Týždeň","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard Denník N a .týždeň 1 mesiac (v3)","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. mája 2025, 19:52:30","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. júna 2025, 19:52:30","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / mesiac za 7,99 (inapp platba)","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23. februára 2025, 6:36:33","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23. marca 2025, 5:36:25","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bonusové dvojdňové predplatné","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. augusta 2024, 23:02:05","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. augusta 2024, 23:02:05","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mini N / 6 mesiacov so 6 € trial zľavou (Subscribe with Google)","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. februára 2024, 22:02:39","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. augusta 2024, 23:01:52","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / 4 týždne za 5,99 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. októbra 2023, 18:47:41","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"30. októbra 2023, 18:47:41","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / 4 týždne za 5,99 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"22. júna 2023, 17:21:19","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20. júla 2023, 17:21:19","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bonusové dvojdňové predplatné","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"18. apríla 2023, 16:51:04","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20. apríla 2023, 16:51:04","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / rok za 47,90 EUR","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"18. apríla 2022, 16:50:06","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"18. apríla 2023, 16:50:06","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / 4 týždne","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21. marca 2022, 16:50:06","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"18. apríla 2022, 16:50:06","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / 4 týždne","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"19. februára 2022, 21:59:22","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"19. marca 2022, 21:59:22","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / 4 týždne","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. januára 2022, 10:46:12","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31. januára 2022, 10:46:12","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / 4 týždne","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. decembra 2021, 16:12:07","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31. decembra 2021, 16:12:07","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"29. októbra 2021, 6:47:26","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"29. novembra 2021, 6:47:26","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.0,"width":0.014930556,"height":0.014444444},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.0,"width":0.15729167,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. augusta 2021, 8:51:45","depth":13,"bounds":{"left":0.66180557,"top":0.0,"width":0.10763889,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. septembra 2021, 8:51:45","depth":13,"bounds":{"left":0.80972224,"top":0.0,"width":0.119791664,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.0,"width":0.014930556,"height":0.014444444},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.0,"width":0.15729167,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"24. júna 2021, 9:26:56","depth":13,"bounds":{"left":0.66180557,"top":0.0,"width":0.09652778,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"25. júla 2021, 9:26:56","depth":13,"bounds":{"left":0.80972224,"top":0.0,"width":0.09340278,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.00055555557,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.0,"width":0.15729167,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23. mája 2021, 7:32:29","depth":13,"bounds":{"left":0.66180557,"top":0.0,"width":0.099305555,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"23. júna 2021, 7:32:29","depth":13,"bounds":{"left":0.80972224,"top":0.0,"width":0.096875,"height":0.018333333},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.041666668,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.038333334,"width":0.15729167,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. apríla 2021, 8:53:25","depth":13,"bounds":{"left":0.66180557,"top":0.038333334,"width":0.10208333,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16. mája 2021, 8:53:25","depth":13,"bounds":{"left":0.80972224,"top":0.038333334,"width":0.099305555,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.082777776,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.079444446,"width":0.15729167,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. marca 2021, 8:53:25","depth":13,"bounds":{"left":0.66180557,"top":0.079444446,"width":0.10555556,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15. apríla 2021, 8:53:25","depth":13,"bounds":{"left":0.80972224,"top":0.079444446,"width":0.10243055,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.12388889,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.12055556,"width":0.15729167,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"8. februára 2021, 4:12:51","depth":13,"bounds":{"left":0.66180557,"top":0.12055556,"width":0.109375,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11. marca 2021, 4:12:51","depth":13,"bounds":{"left":0.80972224,"top":0.12055556,"width":0.10555556,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.165,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Webové mini predplatné N / mesiac","depth":13,"bounds":{"left":0.28715277,"top":0.16166666,"width":0.15729167,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"8. januára 2021, 4:12:51","depth":13,"bounds":{"left":0.66180557,"top":0.16166666,"width":0.10486111,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"8. februára 2021, 4:12:51","depth":13,"bounds":{"left":0.80972224,"top":0.16166666,"width":0.109375,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.20611112,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"bounds":{"left":0.29409721,"top":0.20611112,"width":0.031597223,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"bounds":{"left":0.33715278,"top":0.20611112,"width":0.06111111,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / mesiac","depth":13,"bounds":{"left":0.40243056,"top":0.20277777,"width":0.15208334,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16. septembra 2020, 13:18:28","depth":13,"bounds":{"left":0.66180557,"top":0.20277777,"width":0.13055556,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"17. októbra 2020, 13:18:28","depth":13,"bounds":{"left":0.80972224,"top":0.20277777,"width":0.11736111,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.24722221,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"bounds":{"left":0.29409721,"top":0.24722221,"width":0.031597223,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"bounds":{"left":0.33715278,"top":0.24722221,"width":0.06111111,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / mesiac","depth":13,"bounds":{"left":0.40243056,"top":0.24388888,"width":0.15208334,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16. augusta 2020, 8:37:44","depth":13,"bounds":{"left":0.66180557,"top":0.24388888,"width":0.11319444,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16. septembra 2020, 8:37:44","depth":13,"bounds":{"left":0.80972224,"top":0.24388888,"width":0.08993056,"height":0.040555555},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.31055555,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandard","depth":13,"bounds":{"left":0.29409721,"top":0.31055555,"width":0.031597223,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mobilné aplikácie","depth":13,"bounds":{"left":0.33715278,"top":0.31055555,"width":0.06111111,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Štandardné predplatné N / mesiac","depth":13,"bounds":{"left":0.40243056,"top":0.30722222,"width":0.15208334,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"11. júna 2020, 6:49:27","depth":13,"bounds":{"left":0.66180557,"top":0.30722222,"width":0.09652778,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12. júla 2020, 6:49:27","depth":13,"bounds":{"left":0.80972224,"top":0.30722222,"width":0.09340278,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.35166666,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Týždeň","depth":13,"bounds":{"left":0.29409721,"top":0.35166666,"width":0.025,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mesačné predplatné dennikn.sk a tyzden.sk","depth":13,"bounds":{"left":0.3236111,"top":0.34833333,"width":0.19340278,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"30. marca 2020, 13:07:55","depth":13,"bounds":{"left":0.66180557,"top":0.34833333,"width":0.11076389,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"29. apríla 2020, 13:07:55","depth":13,"bounds":{"left":0.80972224,"top":0.34833333,"width":0.10763889,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Web","depth":13,"bounds":{"left":0.26770833,"top":0.39277777,"width":0.014930556,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Týždeň","depth":13,"bounds":{"left":0.29409721,"top":0.39277777,"width":0.025,"height":0.014444444},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Mesačné predplatné dennikn.sk a tyzden.sk","depth":13,"bounds":{"left":0.3236111,"top":0.38944444,"width":0.19340278,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"28. februára 2020, 13:07:55","depth":13,"bounds":{"left":0.66180557,"top":0.38944444,"width":0.12013889,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"30. marca 2020, 13:07:55","depth":13,"bounds":{"left":0.80972224,"top":0.38944444,"width":0.11111111,"height":0.018333333},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9085722388854589961
|
6646913098307605355
|
click
|
accessibility
|
NULL
|
Pull requests · screenpipe/screenpipe · GitHub
Pul Pull requests · screenpipe/screenpipe · GitHub
Pull requests · screenpipe/screenpipe · GitHub
Home | Hostinger
Home | Hostinger
Login – Nginx Proxy Manager
Login – Nginx Proxy Manager
Screenpipe — Archive
Screenpipe — Archive
SQLite Web: archive.db
SQLite Web: archive.db
SQLite Web: db.sqlite
SQLite Web: db.sqlite
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
screenpipe/.claude/skills at main · screenpipe/screenpipe · GitHub
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
Moje predplatné | Denník N
Moje predplatné | Denník N
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Preskočiť hlavnú navigáciu
Preskočiť hlavnú navigáciu
Denník N
Denník N
Denník N
[EMAIL]
[EMAIL]
Predplatné
Predplatné
Platby
Platby
Newslettre
Newslettre
Témy a autori
Témy a autori
Adresa, faktúry
Adresa, faktúry
Nastavenia
Nastavenia
Odhlásiť
Odhlásiť
Predĺžiť predplatné
Predĺžiť predplatné
Zmeniť predplatné / Upgrade
Zmeniť predplatné / Upgrade
História predplatných
História predplatných
Predplatné
Od
Do
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / 4 týždne za 7,99 EUR
7. mája 2026, 17:59:50
4. júna 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / 4 týždne za 7,99 EUR
9. apríla 2026, 17:59:50
Aktuálne
7. mája 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / 4 týždne za 7,99 EUR
12. marca 2026, 17:59:50
9. apríla 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandard predplatné na 4 týždne za polovičnú cenu
12. februára 2026, 17:59:50
12. marca 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandard predplatné na 4 týždne za polovičnú cenu
15. januára 2026, 17:59:50
12. februára 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Štandard predplatné na 4 týždne za polovičnú cenu
18. decembra 2025, 17:59:50
15. januára 2026, 17:59:50
Web
Štandard
Mobilné aplikácie
Akciové štandard predplatné N 2025 / 12 týždňov za 1,00 EUR
25. septembra 2025, 17:59:50
18. decembra 2025, 17:59:50
Web
Štandard
Mobilné aplikácie
Týždeň
Štandard Denník N a .týždeň 1 mesiac (v3)
15. mája 2025, 19:52:30
15. júna 2025, 19:52:30
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac za 7,99 (inapp platba)
23. februára 2025, 6:36:33
23. marca 2025, 5:36:25
Web
Bonusové dvojdňové predplatné
2. augusta 2024, 23:02:05
4. augusta 2024, 23:02:05
Web
Mini N / 6 mesiacov so 6 € trial zľavou (Subscribe with Google)
2. februára 2024, 22:02:39
2. augusta 2024, 23:01:52
Web
Webové mini predplatné N / 4 týždne za 5,99 EUR
2. októbra 2023, 18:47:41
30. októbra 2023, 18:47:41
Web
Webové mini predplatné N / 4 týždne za 5,99 EUR
22. júna 2023, 17:21:19
20. júla 2023, 17:21:19
Web
Bonusové dvojdňové predplatné
18. apríla 2023, 16:51:04
20. apríla 2023, 16:51:04
Web
Webové mini predplatné N / rok za 47,90 EUR
18. apríla 2022, 16:50:06
18. apríla 2023, 16:50:06
Web
Webové mini predplatné N / 4 týždne
21. marca 2022, 16:50:06
18. apríla 2022, 16:50:06
Web
Webové mini predplatné N / 4 týždne
19. februára 2022, 21:59:22
19. marca 2022, 21:59:22
Web
Webové mini predplatné N / 4 týždne
3. januára 2022, 10:46:12
31. januára 2022, 10:46:12
Web
Webové mini predplatné N / 4 týždne
3. decembra 2021, 16:12:07
31. decembra 2021, 16:12:07
Web
Webové mini predplatné N / mesiac
29. októbra 2021, 6:47:26
29. novembra 2021, 6:47:26
Web
Webové mini predplatné N / mesiac
1. augusta 2021, 8:51:45
1. septembra 2021, 8:51:45
Web
Webové mini predplatné N / mesiac
24. júna 2021, 9:26:56
25. júla 2021, 9:26:56
Web
Webové mini predplatné N / mesiac
23. mája 2021, 7:32:29
23. júna 2021, 7:32:29
Web
Webové mini predplatné N / mesiac
15. apríla 2021, 8:53:25
16. mája 2021, 8:53:25
Web
Webové mini predplatné N / mesiac
15. marca 2021, 8:53:25
15. apríla 2021, 8:53:25
Web
Webové mini predplatné N / mesiac
8. februára 2021, 4:12:51
11. marca 2021, 4:12:51
Web
Webové mini predplatné N / mesiac
8. januára 2021, 4:12:51
8. februára 2021, 4:12:51
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac
16. septembra 2020, 13:18:28
17. októbra 2020, 13:18:28
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac
16. augusta 2020, 8:37:44
16. septembra 2020, 8:37:44
Web
Štandard
Mobilné aplikácie
Štandardné predplatné N / mesiac
11. júna 2020, 6:49:27
12. júla 2020, 6:49:27
Web
Týždeň
Mesačné predplatné dennikn.sk a tyzden.sk
30. marca 2020, 13:07:55
29. apríla 2020, 13:07:55
Web
Týždeň
Mesačné predplatné dennikn.sk a tyzden.sk
28. februára 2020, 13:07:55
30. marca 2020, 13:07:55...
|
619
|
NULL
|
NULL
|
NULL
|
|
20062
|
862
|
6
|
2026-05-11T14:25:36.377017+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778509536377_m1.jpg...
|
PhpStorm
|
faVsco.js – ClientTest.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ClientTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'ClientTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9084867502626116151
|
-8897968962923951744
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'
SlackFileEditViewGoHistoryWindowHelpAPP ()DOCKER₴81DEV (docker)₴2APP (-zsh)-zsh* @param string SobjectType The object type('deals''companies''contacts''cal)* @param array<string, mixed>Spayload Thesearch payload with filters, sorts, prop‹* @return array The search response with'results''total'*'paging'keys* @throws RateLimitException When rate limit is hit* @throws HubspotException On API errors** @return array The search response with 'results', 'total', 'paging' keys*/public function search(string SobjectType, array Spayload): arrayend diff4) app/Console/Commands/JiminnyDebugCommand.php (statement_indentation)begin diff --/home/jiminny/app/Console/Commands/JiminnyDebugCommand.php+++/home/jiminny/app/Console/Commands/JiminnyDebugCommand.php-359,11+359,11 @ScrmService = ScrmResolver->prepareCrmService);-//-/1for ($i = 0; si < 3; Si++) {if (Si % 250) {Sthis->info("Syncing opportunity {Si}");Sthis->info("Matching contact {$i}");-1/-1/.+++++ScrmService->syncOpportunity('374720564');if ($i % 25=0{//Sthis->info("Syncing opportunity {$i}");Sthis->info("Matching contact {$i}");////}ScrmService->syncOpportunity('374720564');$crmService->matchByName('Robot');end diffFixed 4 of 5666 files in 146.870 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any containeror image →Learn more at https://docs.docker.com/go/debug-cli/lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20725-handle-HS-search-rate-lir• 0EDHomeDMsActivityFilesLater...More→Jiminny ...# contusion-clinic# curiosity_lab# engineering# general# jiminny-bg# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the_people_of jimi...^ Direct messagesP. Aneliya Angelova®. Galya Dimitrova. Petko Kashinski&. Stefka StoyanovaVasil Vasilev&. Nikolay IvanovAneliya Angelova, ...Stoyan Tanev• VesE Lukas Kovalik y... 0::: AppsS Jira CloudToast(abl100% <78• Mon 11 May 17:25:36Describe what you are looking for# releases8 226 0MessagesC Files• Bookmarkso Puonicumihailmihaylovjir]Today ~4ff69be1 - JY-17836: Handle non-botactivitiesaf953504 - Merge pull request #12067 fromjiminny/JY-17836-participant-speeches-hotfixjiminny/app Added by GitHubGitHub APP 5:10 PM13 new commits pushed to master by ilian-jiminny9353b609 - JY-20395 wipbee402b7 - JY-20395 Stop fetching ALLheaders (including file) for email importd6a0fe5a - JY-20395 lintdaa0373e - JY-20395 lint fixesaf59d609 - JY-20395 Removed no longer usedmethodsShow morejiminny/app | Added by GitHubCircleCl APP 5:11 PMDeployment Successful!Project: appWhen:05/11/202614:11:35Tag:View JobMessage #releases..•...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
20387
|
880
|
10
|
2026-05-11T15:21:20.619562+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778512880619_m1.jpg...
|
PhpStorm
|
faVsco.js – custom.log
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ClientTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'ClientTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9084867502626116151
|
-8897968962923951744
|
visual_change
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpAPP (-zsh)DOCKER-232,9+235,11₴81DEV (docker)₴2APP (-zsh)-zsheparam@param array<string,arraye soine myxe i spobteat the s earch say oc nr'companies','contacts','calls')mixed> Spayload The search payload with filters, sorts, properties, etc.ereturn arrayThesearch response with'results'total','paging'keys* @throws RateLimitException When rate limit is hit* @throws HubspotException On API errors@return array The search response with'results','total','paging"keys*/public function search(string SobjectType, array Spayload): array>0 lbl 0A-zshX5screenpipe™100% <78• Mon 11 May 18:21:20181O ₴6-zsh87+APPend diffann/Console/(ommonds/liminnvDehunfommondnhn (ctotementindentation)PS$IPhpStormSthis->info("Syncing opportunity {$i}");Sthis->info("Matchingcontact {Si}");ScrmService->syncOpportunity(374720564");if ($i % 25 === 0) {Sthis->info("Syncing opportunity {$1}");Sthis->info("Matching contact {Si}");}//ScrmService->syncOpportunity('374720564');$crmService->matchByName('Robot');Nend diffFixed 4 of 5666 files in 146.870 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
20564
|
892
|
6
|
2026-05-11T15:52:25.656673+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778514745656_m1.jpg...
|
PhpStorm
|
faVsco.js – ClientTest.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ClientTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'ClientTest'","depth":6,"on_screen":true,"is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9084867502626116151
|
-8897968962923951744
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpDOCKERAPP (-zsh)-zsh+- ₴81DEV (docker)₴2APP (-zsh)ScrmService->syncOpportunity('374720564');ScrmService-›matchByName('Robot');-zsh> 0 hhl*5screenpipe"100% <78• Mon 11 May 18:52:25T₴1O ₴6-zsh*7 |+end diffAPPFixed 4 of 5666 files in 146.870 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistentdebugging tools in any container or image → docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20725-handle-HS-search-rate-limit) $ csfixdocker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHP runtime: 8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfig default from".php-cs-fixer.dist.php".5666/5666 [100%Fixed 0 of 5666 files in 66.457 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image » docker debug docker_1amp_1Learn more at https://docs.docker.com/go/debug-cli/lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20725-handle-HS-search-rate-limit) $ I...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
20565
|
893
|
7
|
2026-05-11T15:52:25.651332+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778514745651_m2.jpg...
|
PhpStorm
|
faVsco.js – ClientTest.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.09541223,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: JY-20725-handle-HS-search-rate-limit","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8597075,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"ClientTest","depth":6,"bounds":{"left":0.875,"top":0.019952115,"width":0.04055851,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'ClientTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9084867502626116151
|
-8897968962923951744
|
click
|
hybrid
|
NULL
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
ClientTest
Run 'ClientTest'
PhostormVIewNavigateCodeLaravelKeractorFV faVsco.js?9 JY-20725-handle-HS-search-rate-limitProledey• m HelnersC) UserAutomatedReportscontroller.ong• m HubsnotMActions© MatchacuivitycrmData.ong• DDTO• O Fields> @ Journal> @ OpportunitySyncv D Pagination© HubspotPagiC PaginationCcC PaginationSt:> 0 ProspectSearch<?phpdeclarelstrict tyoessio:namespace Tests Unit Services Crm Hubspot:use…..>- service lraits> C WebhookC) BatchSvncCollerC) BatchSvncRedis3ui to Cascade i to Command* QrunTestsTnSenarateProcessesc) ClientTest.ono©) ClosedDealStaa* @preserveGlobalState disabled(c) DealFieldsServicclass Clienttest eytends TestfaseSholfCancola yLog xChanaes & files= env.local aor.© Client.php app/Services/Crm/Hubspotc ClientTect nhn tectc/Unit/Services/Crm/HubsnotHandleHubspotRateLimitTest.php tests/Unit/Jobs/Middleware© JiminnyDebugCommand.php app/Console/Commandsphp logging.php config© MatchActivityCrmData.php app/Jobs/Crm© RateLimitException.php app/ExceptionsUnversioned Files 9 filesE.env.nikilocal app= env.other app© CanAccessAiReportsTest.php tests/Unit/Policies© CreateMockAskJiminnyReportResultCommand.php app/Console/Commands/Ri tavicon.ico public=ids.txt apdTa raw sal querv.sal app© SimulateWebhooksCommand.php app/Console/Commands/Crm/HubspotM. WEBTOOK FILTERING IMPLEMENTATION.mo a0dmelpG RematchActivityOnCrmObjectDetach.phphuospot/serwice.pnp© RateLimitException.php© HubspotPaginationService.php© SyncCrmEntitiesTrait.php(C) TrackAutomatedReportGenerateaevent.onpC) CachedCrmServiceDecorator.ong© CheckAndRetryRemoteMatch.php© ClientTest.php xC) Kernel.phpA19 A144 M11 ^TJ0 + → = Side-by-side viewer •8 02d5214b app/Jobs/Crm/MatchActivityCrmData.phpDo not ignoreHighlight wordsXBB ?'exception' => sexception->qetMessaqeo.'attempts = sthis->attemptso.if (Sexcention instanceof RateLimitException ll Sexcention instanceof \Illuminate\Queue\MaxAttemotsExceededException) {Loa::warnina(" MatchActivitvermbatal Joo permanently failed due to rate Limiting'. Scontext)»}else {Log::error('[MatchActivityCrmData) Job permanently failed after all retries', Scontext);Tacts naccod: 80 (a minute aaolhhl100% C47 • Mon 11 May 18:52:25ClientTestA SF [jiminny@localhost]4 HS_local [jiminny@localhost]A console [PROD]A console [EUiconsole [STAGINGI"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWM0Q.UfZEXDZyHz2mBUFdzdo2gTHEs0kX1 =07-May-26 14:51:15 GMT: domain=.hubapi.com: Http0nly: Secure: SameSite=None"]."кeрoгс-1о"."?"url": "https:V/AWa.nel.cloudfLare.com/V/report|V/v4?s=NYALsVTP0fYm52qrsDgxYE4sd2RwRq15p5wHsmd=g<LZOYdxLx2B1XVpHmsKnS0%2BKVA5mFLJ2m/YRECD65Ho2BW2LYT206FM4%2lm"max age":604800*"]"success traction".0.olg"max age":6048002""Serven":"cloudflare"?>4"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",1 differenceTeirront vorcian'exception' => $exception->getMessage()'attempts = sthis->attemptso.// RateLimitException reaches failed() only when retryUntil() expires while the job is// still held in the "released" state by HandleHubspotRateLimit - the middleware neven// re-throws, so the exception is not the direct cause of the failure in normal flowif (Sexcention instanceof RateLimitException ll Sexcention instanceof \Tlluminate\Queue\MaxAttemotsExceededException) ≤Loa::warnina('[MatchActivitvCrmDatal Job permanently failed due to rate limiting' Scontext):}else {Log::error('[MatchActivityCrmData) Job permanently failed after all retries', $context):W Windsurf Teams 44:1 UTF-8 Pa 4 spaces ®...
|
20561
|
NULL
|
NULL
|
NULL
|
|
17966
|
782
|
8
|
2026-05-11T10:43:44.126670+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778496224126_m1.jpg...
|
PhpStorm
|
faVsco.js – laravel.log
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelpld6]Support Daily - in 1h 17 m100% <8• Mon 11 May 13:43:43T81DEV (docker)-zshDOCKER₴81DEV (docker)$2APP (-zsh)H3viewsjiminny-worker-processing-2:jiminny-worker-processing-2_00: stoppedjiminny-worker-processing-3:jiminny-worker-processing-3_00: stoppedjiminny-worker-processing-4:jiminny-worker-processing-4_00: stoppedjiminny-worker-processing-5:jiminny-worker-processing-5_00: stoppedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: stoppedworker-analytics:worker-analytics_00: stoppedworker-conferences:worker-conferences_00: stoppedworker-crm-update:worker-crm-update_00: stoppedworker-download:worker-download_00: stoppedworker-emails:worker-emails_00: stoppedworker-nudges:worker-nudges_00: stoppedworker:worker_00: stoppedworker-audio:worker-audio_00: stoppedworker-calendar:worker-calendar_00: stoppedworker-crm-sync:worker-crm-sync_00: stoppedartisan-schedule:artisan-schedule_00: stoppedworker-es-update:worker-es-update_00: stoppedjiminny-worker-processing-1: jiminny-worker-processing-1_00: stoppedartisan-schedule:artisan-schedule_00: startedjiminny-worker-processing-1:jiminny-worker-processing-1_00: startedjiminny-worker-processing-2:jiminny-worker-processing-2_00: startedjiminny-worker-processing-3:jiminny-worker-processing-3_00: startedjiminny-worker-processing-4:jiminny-worker-processing-4_00: startedjiminny-worker-processing-5:jiminny-worker-processing-5_00: startedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: startedworker:worker_00: startedworker-analytics:worker-analytics_00: startedworker-audio:worker-audio_00: startedworker-calendar:worker-calendar_00: startedworker-conferences:worker-conferences_00: startedworker-crm-sync:worker-crm-sync_00: startedworker-crm-update:worker-crm-update_00: startedworker-download:worker-download_00: startedworker-emails:worker-emails_00: startedworker-es-update:worker-es-update_00: startedworker-nudges:worker-nudges_00: startedroot@docker_lamp_1:/home/jiminny#php artisan jiminny: debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# php artisan jiminny:debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# ]84-zshX5screenpipe"O 8865.46ms DONE-zshDEV...
|
NULL
|
9084699997369329956
|
NULL
|
click
|
ocr
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelpld6]Support Daily - in 1h 17 m100% <8• Mon 11 May 13:43:43T81DEV (docker)-zshDOCKER₴81DEV (docker)$2APP (-zsh)H3viewsjiminny-worker-processing-2:jiminny-worker-processing-2_00: stoppedjiminny-worker-processing-3:jiminny-worker-processing-3_00: stoppedjiminny-worker-processing-4:jiminny-worker-processing-4_00: stoppedjiminny-worker-processing-5:jiminny-worker-processing-5_00: stoppedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: stoppedworker-analytics:worker-analytics_00: stoppedworker-conferences:worker-conferences_00: stoppedworker-crm-update:worker-crm-update_00: stoppedworker-download:worker-download_00: stoppedworker-emails:worker-emails_00: stoppedworker-nudges:worker-nudges_00: stoppedworker:worker_00: stoppedworker-audio:worker-audio_00: stoppedworker-calendar:worker-calendar_00: stoppedworker-crm-sync:worker-crm-sync_00: stoppedartisan-schedule:artisan-schedule_00: stoppedworker-es-update:worker-es-update_00: stoppedjiminny-worker-processing-1: jiminny-worker-processing-1_00: stoppedartisan-schedule:artisan-schedule_00: startedjiminny-worker-processing-1:jiminny-worker-processing-1_00: startedjiminny-worker-processing-2:jiminny-worker-processing-2_00: startedjiminny-worker-processing-3:jiminny-worker-processing-3_00: startedjiminny-worker-processing-4:jiminny-worker-processing-4_00: startedjiminny-worker-processing-5:jiminny-worker-processing-5_00: startedjiminny-worker-processing-delayed: jiminny-worker-processing-delayed_00: startedworker:worker_00: startedworker-analytics:worker-analytics_00: startedworker-audio:worker-audio_00: startedworker-calendar:worker-calendar_00: startedworker-conferences:worker-conferences_00: startedworker-crm-sync:worker-crm-sync_00: startedworker-crm-update:worker-crm-update_00: startedworker-download:worker-download_00: startedworker-emails:worker-emails_00: startedworker-es-update:worker-es-update_00: startedworker-nudges:worker-nudges_00: startedroot@docker_lamp_1:/home/jiminny#php artisan jiminny: debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# php artisan jiminny:debugDispatching 100 MatchActivityCrmData jobs (portal=2)Done. Watch logs and run jiminny:debug observeRateLimit to inspect cache state.root@docker_lamp_1:/home/jiminny# ]84-zshX5screenpipe"O 8865.46ms DONE-zshDEV...
|
17964
|
NULL
|
NULL
|
NULL
|
|
28739
|
1163
|
48
|
2026-05-12T18:23:31.717262+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-12/1778 /Users/lukas/.screenpipe/data/data/2026-05-12/1778610211717_m1.jpg...
|
Windsurf
|
screenpipe [SSH: nas] — screenpipe_sync.sh — Modif screenpipe [SSH: nas] — screenpipe_sync.sh — Modified...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Explorer (⌥⌘E)
Search (⇧⌘F)
Source Control (⇧⌘ Explorer (⌥⌘E)
Search (⇧⌘F)
Source Control (⇧⌘G) - 14 pending changes
14
Codemaps
DeepWiki
Run and Debug
Remote Explorer
Extensions (⇧⌘X)
Explorer
Explorer
Explorer Section: screenpipe [SSH: nas]
Explorer Section: screenpipe [SSH: nas]
screenpipe [SSH: nas]
#recycle
app
data
logs
pipes
.gitignore
app_settings.json
archive.db
archive.db-bak
U
archive.db.bak-pre-installid
U
db.sqlite
db.sqlite-shm
db.sqlite-wal
screenpipe_fts_migrate.sh
U
screenpipe_sync copy.sh
U
screenpipe_sync_updated.sh
U
screenpipe_sync.sh
M
screenpipe.db
Outline Section
Outline
Outline
Timeline Section
Timeline
Timeline
remote SSH: nas
SSH: nas
screenpipe (Git) - master*, Checkout Branch/Tag...
master*
screenpipe (Git) - Synchronize Changes
No Problems
0
0
Forwarded Ports: 41257, 36613
2
Notifications
Windsurf - Settings
Teams, Daily: 0% quota used · Weekly: 68% quota used
Shell Script
LF
UTF-8
Spaces: 2
Ln 236, Col 32 (11 selected)
Screen Reader Optimized
git-commit Lukas Kovalik (2 weeks ago)
Lukas Kovalik (2 weeks ago)
SELECT DISTINCT video_chunk_id FROM main.frames, 10 of 11 found for 'video_chunk', at 236:21
Command Succeeded
Syncing Screenpipe Data
1h
19m
1m
get familiar with the project. The idea is to copy the data from mac to nas (here). I am tryign to update the database using
@
screenpipe_fts_migrate.sh
and then run
@
screenpipe_sync.sh
for a day to move the data. Review and see is you understand everything.
Expand content to scroll
Thought
for 1s
I'll read the two scripts and explore the project structure to understand the data migration setup.
Thoughts
Read
screenpipe_fts_migrate.sh and screenpipe_sync.sh
Analyzed
/volume1/screenpipe
Thought
for 2s
I understand the setup. Here's my analysis:
Project Overview
Project Overview
You're migrating Screenpipe data from Mac to NAS. The workflow:
1.
screenpipe_fts_migrate.sh
- One-time database schema migration:
Adds
install_id
column to all synced tables (prevents ID collisions across reinstalls)
Creates
_installs
registry table
Rebuilds FTS (full-text search) tables with new schema...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Explorer (⌥⌘E)","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":true},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Search (⇧⌘F)","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Source Control (⇧⌘G) - 14 pending changes","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Codemaps","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"DeepWiki","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Run and Debug","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Remote Explorer","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Extensions (⇧⌘X)","depth":18,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer","depth":17,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"Explorer","depth":18,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Explorer Section: screenpipe [SSH: nas]","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Explorer Section: screenpipe [SSH: nas]","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"screenpipe [SSH: nas]","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"#recycle","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"data","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"logs","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"pipes","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":".gitignore","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"app_settings.json","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"archive.db","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"archive.db-bak","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"archive.db.bak-pre-installid","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.sqlite","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.sqlite-shm","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"db.sqlite-wal","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_fts_migrate.sh","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_sync copy.sh","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_sync_updated.sh","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"U","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_sync.sh","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"M","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe.db","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Outline Section","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Outline","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"Outline","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Timeline Section","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Timeline","depth":22,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"Timeline","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"remote SSH: nas","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"SSH: nas","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"screenpipe (Git) - master*, Checkout Branch/Tag...","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"master*","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"screenpipe (Git) - Synchronize Changes","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"No Problems","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"0","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Forwarded Ports: 41257, 36613","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Notifications","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Windsurf - Settings","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Teams, Daily: 0% quota used · Weekly: 68% quota used","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Shell Script","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"LF","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"UTF-8","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Spaces: 2","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Ln 236, Col 32 (11 selected)","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screen Reader Optimized","depth":16,"bounds":{"left":1.0,"top":0.0,"width":-0.06944442,"height":0.02},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"git-commit Lukas Kovalik (2 weeks ago)","depth":16,"bounds":{"left":0.9583333,"top":0.0,"width":0.041666687,"height":0.02},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":17,"bounds":{"left":0.9611111,"top":0.0,"width":0.009722223,"height":0.015555556},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Lukas Kovalik (2 weeks ago)","depth":17,"bounds":{"left":0.97083336,"top":0.0,"width":0.029166639,"height":0.013333334},"on_screen":true,"lines":[{"char_start":0,"char_count":1,"bounds":{"left":0.97083336,"top":0.0,"width":0.0020833334,"height":0.013333334}},{"char_start":1,"char_count":26,"bounds":{"left":0.97291666,"top":0.0,"width":0.027083337,"height":0.013333334}}],"role_description":"text"},{"role":"AXStaticText","text":"SELECT DISTINCT video_chunk_id FROM main.frames, 10 of 11 found for 'video_chunk', at 236:21","depth":12,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Command Succeeded","depth":12,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Syncing Screenpipe Data","depth":20,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1h","depth":19,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"19m","depth":19,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"1m","depth":19,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"get familiar with the project. The idea is to copy the data from mac to nas (here). I am tryign to update the database using","depth":25,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"@","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_fts_migrate.sh","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"and then run","depth":25,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"@","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_sync.sh","depth":27,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"for a day to move the data. Review and see is you understand everything.","depth":25,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Expand content to scroll","depth":23,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Thought","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"for 1s","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"I'll read the two scripts and explore the project structure to understand the data migration setup.","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Thoughts","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Read","depth":20,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_fts_migrate.sh and screenpipe_sync.sh","depth":20,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Analyzed","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"/volume1/screenpipe","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Thought","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"for 2s","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"I understand the setup. Here's my analysis:","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXHeading","text":"Project Overview","depth":20,"on_screen":true,"role_description":"heading"},{"role":"AXStaticText","text":"Project Overview","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"You're migrating Screenpipe data from Mac to NAS. The workflow:","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1.","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"screenpipe_fts_migrate.sh","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"- One-time database schema migration:","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Adds","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"install_id","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"column to all synced tables (prevents ID collisions across reinstalls)","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Creates","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"_installs","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"registry table","depth":22,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Rebuilds FTS (full-text search) tables with new schema","depth":22,"on_screen":true,"role_description":"text"}]...
|
9084118436697715474
|
3979500865922703472
|
click
|
accessibility
|
NULL
|
Explorer (⌥⌘E)
Search (⇧⌘F)
Source Control (⇧⌘ Explorer (⌥⌘E)
Search (⇧⌘F)
Source Control (⇧⌘G) - 14 pending changes
14
Codemaps
DeepWiki
Run and Debug
Remote Explorer
Extensions (⇧⌘X)
Explorer
Explorer
Explorer Section: screenpipe [SSH: nas]
Explorer Section: screenpipe [SSH: nas]
screenpipe [SSH: nas]
#recycle
app
data
logs
pipes
.gitignore
app_settings.json
archive.db
archive.db-bak
U
archive.db.bak-pre-installid
U
db.sqlite
db.sqlite-shm
db.sqlite-wal
screenpipe_fts_migrate.sh
U
screenpipe_sync copy.sh
U
screenpipe_sync_updated.sh
U
screenpipe_sync.sh
M
screenpipe.db
Outline Section
Outline
Outline
Timeline Section
Timeline
Timeline
remote SSH: nas
SSH: nas
screenpipe (Git) - master*, Checkout Branch/Tag...
master*
screenpipe (Git) - Synchronize Changes
No Problems
0
0
Forwarded Ports: 41257, 36613
2
Notifications
Windsurf - Settings
Teams, Daily: 0% quota used · Weekly: 68% quota used
Shell Script
LF
UTF-8
Spaces: 2
Ln 236, Col 32 (11 selected)
Screen Reader Optimized
git-commit Lukas Kovalik (2 weeks ago)
Lukas Kovalik (2 weeks ago)
SELECT DISTINCT video_chunk_id FROM main.frames, 10 of 11 found for 'video_chunk', at 236:21
Command Succeeded
Syncing Screenpipe Data
1h
19m
1m
get familiar with the project. The idea is to copy the data from mac to nas (here). I am tryign to update the database using
@
screenpipe_fts_migrate.sh
and then run
@
screenpipe_sync.sh
for a day to move the data. Review and see is you understand everything.
Expand content to scroll
Thought
for 1s
I'll read the two scripts and explore the project structure to understand the data migration setup.
Thoughts
Read
screenpipe_fts_migrate.sh and screenpipe_sync.sh
Analyzed
/volume1/screenpipe
Thought
for 2s
I understand the setup. Here's my analysis:
Project Overview
Project Overview
You're migrating Screenpipe data from Mac to NAS. The workflow:
1.
screenpipe_fts_migrate.sh
- One-time database schema migration:
Adds
install_id
column to all synced tables (prevents ID collisions across reinstalls)
Creates
_installs
registry table
Rebuilds FTS (full-text search) tables with new schema...
|
28737
|
NULL
|
NULL
|
NULL
|
|
103
|
7
|
12
|
2026-05-06T17:43:43.706137+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-06/1778 /Users/lukas/.screenpipe/data/data/2026-05-06/1778089423706_m1.jpg...
|
QuickTime Player
|
compact_monitor_1_1778089220643.mp4
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
rewind
play/pause
fast forward
More Controls
toggl rewind
play/pause
fast forward
More Controls
toggle full screen
show external playback menu
show external playback menu
show media selection menu
toggle picture-in-picture playback
show action menu
share
show chapter menu
zoom
zoom
playback speed
00:24
toggle elapsed time, timecode and framecount
02:10
toggle duration and remaining time
document actions
compact_monitor_1_1778089220643.mp4...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"rewind","depth":1,"bounds":{"left":0.47916666,"top":0.7861111,"width":0.017361112,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"play/pause","depth":1,"bounds":{"left":0.50381947,"top":0.77666664,"width":0.02013889,"height":0.037777778},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"fast forward","depth":1,"bounds":{"left":0.5315972,"top":0.7861111,"width":0.017361112,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"More Controls","depth":1,"bounds":{"left":0.653125,"top":0.78555554,"width":0.0125,"height":0.017777778},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"toggle full screen","depth":1,"bounds":{"left":0.590625,"top":0.7916667,"width":0.013888889,"height":0.022222223},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show external playback menu","depth":1,"bounds":{"left":0.590625,"top":0.78444445,"width":0.013888889,"height":0.022222223},"on_screen":true,"role_description":"button","is_focused":false},{"role":"AXButton","text":"show external playback menu","depth":2,"bounds":{"left":0.590625,"top":0.78444445,"width":0.013888889,"height":0.022222223},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show media selection menu","depth":1,"bounds":{"left":0.590625,"top":0.7916667,"width":0.015277778,"height":0.022222223},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"toggle picture-in-picture playback","depth":1,"bounds":{"left":0.6170139,"top":0.7838889,"width":0.017361112,"height":0.022222223},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show action menu","depth":1,"bounds":{"left":0.590625,"top":0.7911111,"width":0.014583333,"height":0.023333333},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"share","depth":1,"bounds":{"left":0.646875,"top":0.78055555,"width":0.013541667,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"show chapter menu","depth":1,"bounds":{"left":0.590625,"top":0.79444444,"width":0.014583333,"height":0.016666668},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"zoom","depth":1,"bounds":{"left":0.590625,"top":0.78944445,"width":0.013888889,"height":0.026666667},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXCheckBox","text":"zoom","depth":1,"bounds":{"left":0.590625,"top":0.7922222,"width":0.017361112,"height":0.02111111},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"playback speed","depth":1,"bounds":{"left":0.590625,"top":0.7922222,"width":0.013194445,"height":0.02111111},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"00:24","depth":1,"bounds":{"left":0.36215279,"top":0.82277775,"width":0.02638889,"height":0.016666668},"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"toggle elapsed time, timecode and framecount","depth":1,"bounds":{"left":0.36354166,"top":0.82277775,"width":0.023611112,"height":0.016666668},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"02:10","depth":1,"bounds":{"left":0.6340278,"top":0.82277775,"width":0.031597223,"height":0.016666668},"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"toggle duration and remaining time","depth":1,"bounds":{"left":0.6354167,"top":0.82277775,"width":0.028819444,"height":0.016666668},"on_screen":true,"role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false},{"role":"AXMenuButton","text":"document actions","depth":1,"bounds":{"left":0.6173611,"top":0.033333335,"width":0.0069444445,"height":0.017777778},"on_screen":true,"role_description":"menu button","is_enabled":false,"is_focused":false},{"role":"AXStaticText","text":"compact_monitor_1_1778089220643.mp4","depth":1,"bounds":{"left":0.42222223,"top":0.033333335,"width":0.19513889,"height":0.017777778},"on_screen":true,"role_description":"text"}]...
|
9083833690402723101
|
7064790798728698486
|
click
|
hybrid
|
NULL
|
rewind
play/pause
fast forward
More Controls
toggl rewind
play/pause
fast forward
More Controls
toggle full screen
show external playback menu
show external playback menu
show media selection menu
toggle picture-in-picture playback
show action menu
share
show chapter menu
zoom
zoom
playback speed
00:24
toggle elapsed time, timecode and framecount
02:10
toggle duration and remaining time
document actions
compact_monitor_1_1778089220643.mp4
QuickTime Player•FileEditViewWindowHelp40compact_monitor_1_1778089220643.mp4 ~screenpipe"-zsh-rw--rw--rw--rw-i-rw-!-rW-I-rw-!-rw-I-rw--rw-l-rW--rw-!-rw-I-rw-i-rw--ГW--rw-i-rw-|-rw-i-rw-!-rW--rw--rw-I-rw-i-rw-l-rw-i-rw-I-rw--rw-l-rW-I-rw-!-rw-IDOCKERX1X2APP (-zsh)settingaudio chunk durationportaudio disabledvision disabledpause on DRM contentaudio enginevad enginedata directorydebug modetelemetryuse pii removaluse all monitorsignored windowsincluded windowscloud syncauto-destruct piddeepgram keyapi authencrypt secretsretention daysretention modelanguagesmonitorsaudio devicesDEV (docker)value30 seconds3030falsefalsefalseParakeetSilero/Users/lukas/.screenpipefalsetruetruetrue["Boosteroid"]disabled0not setenableddisabledmedia-only (keep transcripts)all languagesid: 1id: 2-rw-!-ГW--rw-MacBook Pro Microphone (input)System Audio (output)00:24-rw-are using local processing. alldata stays onyoucomputer.-rw--rw-lwarning: telemetry is enabled.only error-leveldata will be sent.to disable, use the --disable-telemetry flag.-rw-iluka!check latest changes here: https://github.com/screenpipe/screenpipe/releasesluka: 2026-05-06T20:27:34.6383847INFO screenpipe: starting UI event captureX4Gscreenpipe*97% <4Wed 6 May 20:43:431X1-zshX6X5Qu you‹ › x»02:10...
|
102
|
/Users/lukas/.screenpipe/data/data/2026-05-06/comp /Users/lukas/.screenpipe/data/data/2026-05-06/compact_monitor_1_1778089220643.mp4...
|
NULL
|
NULL
|
|
48479
|
1722
|
0
|
2026-05-15T09:58:03.872664+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-15/1778 /Users/lukas/.screenpipe/data/data/2026-05-15/1778839083872_m1.jpg...
|
Slack
|
Galya Dimitrova (DM) - Jiminny Inc - 4 new items - Galya Dimitrova (DM) - Jiminny Inc - 4 new items - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
3
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
bugs
confusion-clinic
curiosity_lab
engineering
general
jiminny-bg
platform-tickets
product_launches
random
releases
sofia-office
support
thank-yous
the_people_of_jiminny
Galya Dimitrova
Stoyan Tomov
Aneliya Angelova
Vasil Vasilev
Stefka Stoyanova
Todor Stamatov
Mario Georgiev
Nikolay Ivanov
James Graham
Stoyan Tanev
Steliyan Georgiev
Petko Kashinski
Lukas Kovalik
you
Jira Cloud
Toast
Google Calendar
Messages
Messages
Files
Files
Untitled
Untitled
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Galya Dimitrova
Yesterday at 4:42:30 PM
4:42 PM
интересно обаче че този тръгна обаче новия евент за AJ Reports в datadog продължава да показва 0
Yesterday at 4:42:33 PM
4:42
много странно
Lukas Kovalik
Yesterday at 5:00:22 PM
5:00 PM
ще го погледна
Lukas Kovalik
Yesterday at 6:24:10 PM
6:24 PM
изглежда има hardcoded period
Yesterday at 6:24:19 PM
6:24
image.png
Toggle file
image.png
Yesterday at 6:24:53 PM
6:24
ако го сменя на past month например излизат данните
Yesterday at 6:25:34 PM
6:25
CleanShot 2026-05-14 at [EMAIL]
Toggle file
CleanShot 2026-05-14 at [EMAIL]
Galya Dimitrova
Yesterday at 6:26:26 PM
6:26 PM
оф много съм зле
Yesterday at 6:26:29 PM
6:26
уж гледах ли гледах
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Yesterday at 6:32:36 PM
6:32 PM
само такива ишюта да има
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Galya Dimitrova
Yesterday at 6:32:48 PM
6:32 PM
хаха
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Yesterday at 6:32:55 PM
6:32
абе можеше дори и без него ама айде
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Jump to date
Galya Dimitrova
Today at 12:01:29 PM
12:01 PM
здравей
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"bugs","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"sofia-office","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"James Graham","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Lukas Kovalik","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"you","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Google Calendar","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"on_screen":true,"role_description":"text"},{"role":"AXRadioButton","text":"Untitled","depth":17,"on_screen":true,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Untitled","depth":19,"on_screen":true,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":22,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Galya Dimitrova","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 4:42:30 PM","depth":23,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"4:42 PM","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"интересно обаче че този тръгна обаче новия евент за AJ Reports в datadog продължава да показва 0","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 4:42:33 PM","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"4:42","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"много странно","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 5:00:22 PM","depth":23,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:00 PM","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ще го погледна","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":23,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:24:10 PM","depth":23,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:24 PM","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"изглежда има hardcoded period","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:24:19 PM","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:24","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":26,"on_screen":false,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Yesterday at 6:24:53 PM","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:24","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"ако го сменя на past month например излизат данните","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:25:34 PM","depth":24,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:25","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"CleanShot 2026-05-14 at 18.25.24@2x.png","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":24,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"CleanShot 2026-05-14 at 18.25.24@2x.png","depth":26,"on_screen":false,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Galya Dimitrova","depth":23,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:26:26 PM","depth":23,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26 PM","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"оф много съм зле","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:26:29 PM","depth":24,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26","depth":25,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"уж гледах ли гледах","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":25,"on_screen":false,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":23,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:32:36 PM","depth":23,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:32 PM","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"само такива ишюта да има","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":25,"on_screen":false,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Galya Dimitrova","depth":23,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXLink","text":"Yesterday at 6:32:48 PM","depth":23,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:32 PM","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"хаха","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":25,"on_screen":false,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Yesterday at 6:32:55 PM","depth":24,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:32","depth":25,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"абе можеше дори и без него ама айде","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":25,"on_screen":false,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"Jump to date","depth":22,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Galya Dimitrova","depth":23,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":23,"on_screen":true,"role_description":"text"},{"role":"AXLink","text":"Today at 12:01:29 PM","depth":23,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"12:01 PM","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"здравей","depth":24,"on_screen":true,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":25,"on_screen":false,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":25,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9083428923711728875
|
-6108125061916998572
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
3
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
bugs
confusion-clinic
curiosity_lab
engineering
general
jiminny-bg
platform-tickets
product_launches
random
releases
sofia-office
support
thank-yous
the_people_of_jiminny
Galya Dimitrova
Stoyan Tomov
Aneliya Angelova
Vasil Vasilev
Stefka Stoyanova
Todor Stamatov
Mario Georgiev
Nikolay Ivanov
James Graham
Stoyan Tanev
Steliyan Georgiev
Petko Kashinski
Lukas Kovalik
you
Jira Cloud
Toast
Google Calendar
Messages
Messages
Files
Files
Untitled
Untitled
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Galya Dimitrova
Yesterday at 4:42:30 PM
4:42 PM
интересно обаче че този тръгна обаче новия евент за AJ Reports в datadog продължава да показва 0
Yesterday at 4:42:33 PM
4:42
много странно
Lukas Kovalik
Yesterday at 5:00:22 PM
5:00 PM
ще го погледна
Lukas Kovalik
Yesterday at 6:24:10 PM
6:24 PM
изглежда има hardcoded period
Yesterday at 6:24:19 PM
6:24
image.png
Toggle file
image.png
Yesterday at 6:24:53 PM
6:24
ако го сменя на past month например излизат данните
Yesterday at 6:25:34 PM
6:25
CleanShot 2026-05-14 at [EMAIL]
Toggle file
CleanShot 2026-05-14 at [EMAIL]
Galya Dimitrova
Yesterday at 6:26:26 PM
6:26 PM
оф много съм зле
Yesterday at 6:26:29 PM
6:26
уж гледах ли гледах
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Yesterday at 6:32:36 PM
6:32 PM
само такива ишюта да има
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Galya Dimitrova
Yesterday at 6:32:48 PM
6:32 PM
хаха
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Yesterday at 6:32:55 PM
6:32
абе можеше дори и без него ама айде
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Jump to date
Galya Dimitrova
Today at 12:01:29 PM
12:01 PM
здравей
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
SlackFileEditViewGoHistoryWindowHelp(MySQL 11.4.9-MariaDB-log) EU/jiminny/text_relaysPROD/jiminny/text_relaysQ text_relayscreated_at3 is afterTABLEStext_relaysid(ahol• Jiminny Tech Day - 5h 2 m left100% <478• Fri 15 May 12:58:04jiminnySelect DatabaseStructureContentRelationsTriggersTable InfoQueryEU/jiminny/text_relaysTable HistoryUsersConsole2026-05-01Filterorigin_actuuid688 K689AĐXu#|©•$Ñ&Ï)¼690@1¼|>ÚTT691 G.óóq¼[¼'#Á=692 M',&*8| ¢ÆEVemail__providergsuitegsuitegsuitegsuitegsuiteemail_provider_id19e1447dea629ed019e1728569327bc819e1c2e118add1fc19e2027868a64b4219e2033ed8ea6b10email_sent_at2026-05-10 23:45:102026-05-11 13:09:332026-05-12 12:33:482026-05-13 10:05:082026-05-13 10:18:39senderDE ZOETEN Scott <Scott.DE-...Kuljit Fowles <[EMAIL] Beatty < [EMAIL] Georgiev <mario.georgi...Stoyan Tomov <stoyan.tomov..recipientstatusMeg Katsiouras <6148501943...failedCampbell Johnston Clark Limit... failedKevin Walker <447480488754...failed447577084583.44789393787... failedMario Georgiev <4478939378... failedcode20002000400022002200+@~+5 rows of 692 match filter...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
56956
|
NULL
|
0
|
2026-05-19T08:42:59.156110+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-19/1779 /Users/lukas/.screenpipe/data/data/2026-05-19/1779180179156_m2.jpg...
|
Firefox
|
Booking.com: Hotels in Lozenets. Book your hotel n Booking.com: Hotels in Lozenets. Book your hotel now! — Personal...
|
1
|
www.booking.com/searchresults.html?ss=Lozenets%2C+ www.booking.com/searchresults.html?ss=Lozenets%2C+Burgas+Province%2C+Bulgaria&efdco=1&label=en-bg-booking-desktop-MtC3OoaoU_ML6gxkUZ2GoAS652796015943%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9217204%3Ali%3Adec%3Adm&aid=2311236&lang=en-us&sb=1&src_elem=sb&src=index&dest_id=-835933&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=en&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=d7cd3d314828019c&ac_meta=GhBkN2NkM2QzMTQ4MjgwMTljIAAoATICZW46BExvemU%3D&checkin=2026-06-26&checkout=2026-07-05&group_adults=2&no_rooms=1&group_children=2&age=6&age=4...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
Getting Started DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
Getting Started · AFFiNE
Getting Started · AFFiNE
Screenpipe — Archive
Screenpipe — Archive
Download screenpipe — get started in minutes
Download screenpipe — get started in minutes
Self-Hosted Software and Apps
Self-Hosted Software and Apps
New Tab
New Tab
Помогнете ни да развиваме My Vivacom – Вашето мнение е важно - [EMAIL] - Gmail
Помогнете ни да развиваме My Vivacom – Вашето мнение е важно - [EMAIL] - Gmail
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Kontakt | Veľvyslanectvo Slovenskej republiky v Sofii
Kontakt | Veľvyslanectvo Slovenskej republiky v Sofii
Nginx Proxy Manager
Nginx Proxy Manager
Location Logger
Location Logger
Providers - Admin - authentik
Providers - Admin - authentik
Booking.com: Hotels in Lozenets. Book your hotel now!
Booking.com: Hotels in Lozenets. Book your hotel now!
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Skip to main content
Skip to main content
Booking.com
Prices in Euro
EUR
Language: English (US)
Customer support
List your property
List your property
Register an account
Register
Sign in
Sign in
Stays
Stays
Flights
Flights
Flight + Hotel
Flight + Hotel
Car rental
Car rental
Attractions
Attractions
Airport taxis
Airport taxis
Lozenets
Lozenets
Clear
Fri, Jun 26 — Sun, Jul 5
Fri, Jun 26
—
Sun, Jul 5
Number of travelers and rooms. Currently selected: 2 adults · 2 children · 1 room
2 adults · 2 children · 1 room
Search
Search
Home
Home
Bulgaria
Bulgaria
Burgas Province
Burgas Province
Lozenets
Lozenets
Search results
Show on map
Show on map
Filter by:
Filter by:
Your budget (per night)
€ 30 – € 400+
Popular filters
Beachfront: 26 properties
Swimming pool: 34 properties
Breakfast & dinner included: 1 property
Villas: 7 properties
Breakfast included: 14 properties
Free Wifi: 59 properties
Parking: 53 properties
Apartments: 25 properties
Smart filters
What are you looking for?
What are you looking for?
Find properties
Find properties
Meals
Breakfast included: 14 properties
Breakfast & dinner included: 1 property
Kitchen facilities: 40 properties
Property Type
Hotels: 23 properties
Apartments: 25 properties
Vacation Homes: 2 properties
Resorts: 2 properties
Villas: 7 properties
Resort Villages: 1 property
Guesthouses: 9 properties
Family-Friendly Properties: 15 properties
Entire homes & apartments: 44 properties
Bedrooms and bathrooms
Bedrooms
Bathrooms
Facilities
Swimming pool: 34 properties
Parking: 53 properties
Free Wifi: 59 properties
Spa: 6 properties
Hot tub/Jacuzzi: 9 properties
Show all 13
Show all 13
Room facilities
Kitchen/Kitchenette: 40 properties
Air conditioning: 62 properties
Sea view: 26 properties
Washing machine: 24 properties
Balcony: 57 properties
Show all 25
Show all 25
Beach Access
Beachfront: 26 properties
Review score
Wonderful: 9+: 35 properties
Very Good: 8+: 46 properties
Good: 7+: 53 properties
Pleasant: 6+: 55 properties
Property rating
Find high-quality hotels and vacation rentals
1 star: 5 properties
2 stars: 9 properties
3 stars: 23 properties
4 stars: 8 properties
5 stars: 1 property
Reservation policy
Free cancellation: 56 properties
Book without credit card: 1 property
Distance from center of Lozenets
Less than 1 km: 55 properties
Less than 3 km: 65 properties
Less than 5 km: 66 properties
Fun Things To Do
Beach: 39 properties
Tennis equipment: 11 properties
Private beach area: 15 properties
Playground: 19 properties
Windsurfing: 11 properties
Travel group
Pet friendly: 18 properties
Family-Friendly Properties: 15 properties
Bed preference
Cribs: 4 properties
Double bed: 60 properties
Twin beds: 31 properties
Highly rated features
Based on guest reviews
Very good breakfast: 1 property
Online Payment
Accepts online payments: 41 properties
Property Accessibility
Bathroom emergency cord: 1 property
Toilet with grab rails: 1 property
Lowered sink: 1 property
Room Accessibility
Entire unit located on ground floor: 12 properties
Upper floors accessible by elevator: 9 properties
Entire unit wheelchair accessible: 6 properties
Roll-in shower: 1 property
Emergency cord in bathroom: 1 property
Shower chair: 1 property
Walk-in shower: 13 properties
Raised toilet: 2 properties
Search results updated. Lozenets: 66 properties found. Sorted by: Top picks for long stays.
Lozenets: 66 properties found
List
List
Grid
Grid
Sort by: Top picks for long stays
Sort by:
Top picks for long stays
Close banner
Commission paid on bookings, and other factors can affect property rankings. Learn about these ranking parameters and how to select and modify them.
Learn more
Learn more
Browse the results for Lozenets
Save this item to a trip list
Family Hotel Kontesa Opens in new window
Family Hotel Kontesa Opens in new window
Family Hotel Kontesa
Opens in new window
3 out of 5
Lozenets·Show on map
Lozenets
·
Show on map
·
100 m from downtown
·
Beach Nearby
300 m from beach
Scored 9.8 Exceptional 196 reviews
Scored 9.8
Exceptional
196 reviews
Comfort: Scored 9.8
Comfort
9.8
Recommended for your group...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Getting Started · AFFiNE","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Getting Started · AFFiNE","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.04255319,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Download screenpipe — get started in minutes","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Download screenpipe — get started in minutes","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.0809508,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Self-Hosted Software and Apps","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Self-Hosted Software and Apps","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.054853722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Помогнете ни да развиваме My Vivacom – Вашето мнение е важно - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Помогнете ни да развиваме My Vivacom – Вашето мнение е важно - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.18118352,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Kontakt | Veľvyslanectvo Slovenskej republiky v Sofii","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Kontakt | Veľvyslanectvo Slovenskej republiky v Sofii","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.091090426,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Providers - Admin - authentik","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Providers - Admin - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.05119681,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Booking.com: Hotels in Lozenets. Book your hotel now!","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Booking.com: Hotels in Lozenets. Book your hotel now!","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.09541223,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.47885075,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Skip to main content","depth":7,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to main content","depth":9,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Booking.com","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Prices in Euro","depth":10,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"EUR","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Language: English (US)","depth":10,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Customer support","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"List your property","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"List your property","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Register an account","depth":9,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Register","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Sign in","depth":10,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuItem","text":"Stays","depth":9,"on_screen":false,"help_text":"","role_description":"menu item","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Stays","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuItem","text":"Flights","depth":9,"on_screen":false,"help_text":"","role_description":"menu item","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Flights","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuItem","text":"Flight + Hotel","depth":9,"on_screen":false,"help_text":"","role_description":"menu item","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Flight + Hotel","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuItem","text":"Car rental","depth":9,"on_screen":false,"help_text":"","role_description":"menu item","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Car rental","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuItem","text":"Attractions","depth":9,"on_screen":false,"help_text":"","role_description":"menu item","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Attractions","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuItem","text":"Airport taxis","depth":9,"on_screen":false,"help_text":"","role_description":"menu item","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Airport taxis","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Lozenets","depth":11,"on_screen":false,"value":"Lozenets","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Lozenets","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":11,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Fri, Jun 26 — Sun, Jul 5","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Fri, Jun 26","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"—","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Sun, Jul 5","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Number of travelers and rooms. Currently selected: 2 adults · 2 children · 1 room","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2 adults · 2 children · 1 room","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Search","depth":11,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Home","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Home","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Bulgaria","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Bulgaria","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Burgas Province","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Burgas Province","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Lozenets","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lozenets","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Search results","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Show on map","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Show on map","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Filter by:","depth":10,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Filter by:","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Your budget (per night)","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"€ 30 – € 400+","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Popular filters","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Beachfront: 26 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Swimming pool: 34 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Breakfast & dinner included: 1 property","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Villas: 7 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Breakfast included: 14 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Free Wifi: 59 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Parking: 53 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Apartments: 25 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Smart filters","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"What are you looking for?","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextArea","text":"What are you looking for?","depth":11,"on_screen":false,"help_text":"","placeholder":"Example: I want a place with great reviews and free cancellation","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Find properties","depth":11,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Find properties","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Meals","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Breakfast included: 14 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Breakfast & dinner included: 1 property","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Kitchen facilities: 40 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Property Type","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Hotels: 23 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Apartments: 25 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Vacation Homes: 2 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Resorts: 2 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Villas: 7 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Resort Villages: 1 property","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Guesthouses: 9 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Family-Friendly Properties: 15 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Entire homes & apartments: 44 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Bedrooms and bathrooms","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bedrooms","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Bathrooms","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Facilities","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Swimming pool: 34 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Parking: 53 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Free Wifi: 59 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Spa: 6 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Hot tub/Jacuzzi: 9 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show all 13","depth":11,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Show all 13","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Room facilities","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Kitchen/Kitchenette: 40 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Air conditioning: 62 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Sea view: 26 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Washing machine: 24 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Balcony: 57 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show all 25","depth":11,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Show all 25","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Beach Access","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Beachfront: 26 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Review score","depth":13,"bounds":{"left":0.6072141,"top":0.0,"width":0.03025266,"height":0.013567438},"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Wonderful: 9+: 35 properties","depth":12,"bounds":{"left":0.6072141,"top":0.0,"width":0.0003324468,"height":0.0007980846},"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Very Good: 8+: 46 properties","depth":12,"bounds":{"left":0.6072141,"top":0.0,"width":0.0003324468,"height":0.0007980846},"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Good: 7+: 53 properties","depth":12,"bounds":{"left":0.6072141,"top":0.0,"width":0.0003324468,"height":0.0007980846},"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pleasant: 6+: 55 properties","depth":12,"bounds":{"left":0.6072141,"top":0.0207502,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Property rating","depth":13,"bounds":{"left":0.6072141,"top":0.06264964,"width":0.034906916,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Find high-quality hotels and vacation rentals","depth":13,"bounds":{"left":0.6072141,"top":0.07861133,"width":0.06948138,"height":0.026336791},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"1 star: 5 properties","depth":12,"bounds":{"left":0.6072141,"top":0.10933759,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"2 stars: 9 properties","depth":12,"bounds":{"left":0.6072141,"top":0.13328013,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"3 stars: 23 properties","depth":12,"bounds":{"left":0.6072141,"top":0.15722266,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"4 stars: 8 properties","depth":12,"bounds":{"left":0.6072141,"top":0.1811652,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"5 stars: 1 property","depth":12,"bounds":{"left":0.6072141,"top":0.19074222,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reservation policy","depth":13,"bounds":{"left":0.6072141,"top":0.23264167,"width":0.042386968,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Free cancellation: 56 properties","depth":12,"bounds":{"left":0.6072141,"top":0.25059855,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Book without credit card: 1 property","depth":12,"bounds":{"left":0.6072141,"top":0.2745411,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Distance from center of Lozenets","depth":13,"bounds":{"left":0.6072141,"top":0.31644055,"width":0.076130316,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Less than 1 km: 55 properties","depth":12,"bounds":{"left":0.6072141,"top":0.33439744,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Less than 3 km: 65 properties","depth":12,"bounds":{"left":0.6072141,"top":0.35834,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Less than 5 km: 66 properties","depth":12,"bounds":{"left":0.6072141,"top":0.38228253,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Fun Things To Do","depth":13,"bounds":{"left":0.6072141,"top":0.42418197,"width":0.03939495,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Beach: 39 properties","depth":12,"bounds":{"left":0.6072141,"top":0.44213888,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tennis equipment: 11 properties","depth":12,"bounds":{"left":0.6072141,"top":0.4660814,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Private beach area: 15 properties","depth":12,"bounds":{"left":0.6072141,"top":0.49002394,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Playground: 19 properties","depth":12,"bounds":{"left":0.6072141,"top":0.5139665,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Windsurfing: 11 properties","depth":12,"bounds":{"left":0.6072141,"top":0.53790903,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Travel group","depth":13,"bounds":{"left":0.6072141,"top":0.5798085,"width":0.028756648,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Pet friendly: 18 properties","depth":12,"bounds":{"left":0.6072141,"top":0.5977654,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Family-Friendly Properties: 15 properties","depth":12,"bounds":{"left":0.6072141,"top":0.60814047,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Bed preference","depth":13,"bounds":{"left":0.6072141,"top":0.6500399,"width":0.03523936,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Cribs: 4 properties","depth":12,"bounds":{"left":0.6072141,"top":0.6679968,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Double bed: 60 properties","depth":12,"bounds":{"left":0.6072141,"top":0.69193935,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Twin beds: 31 properties","depth":12,"bounds":{"left":0.6072141,"top":0.7158819,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Highly rated features","depth":13,"bounds":{"left":0.6072141,"top":0.7577813,"width":0.048537236,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Based on guest reviews","depth":13,"bounds":{"left":0.6072141,"top":0.77374303,"width":0.04454787,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Very good breakfast: 1 property","depth":12,"bounds":{"left":0.6072141,"top":0.79010373,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Online Payment","depth":13,"bounds":{"left":0.6072141,"top":0.8320032,"width":0.036070477,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Accepts online payments: 41 properties","depth":12,"bounds":{"left":0.6072141,"top":0.8499601,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Property Accessibility","depth":13,"bounds":{"left":0.6072141,"top":0.89185953,"width":0.05069814,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Bathroom emergency cord: 1 property","depth":12,"bounds":{"left":0.6072141,"top":0.90981644,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Toilet with grab rails: 1 property","depth":12,"bounds":{"left":0.6072141,"top":0.933759,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Lowered sink: 1 property","depth":12,"bounds":{"left":0.6072141,"top":0.94493216,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Room Accessibility","depth":13,"bounds":{"left":0.6072141,"top":0.9868316,"width":0.043550532,"height":0.013168395},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Entire unit located on ground floor: 12 properties","depth":12,"bounds":{"left":0.6072141,"top":1.0,"width":0.0003324468,"height":-0.004788518},"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Upper floors accessible by elevator: 9 properties","depth":12,"bounds":{"left":0.6072141,"top":1.0,"width":0.0003324468,"height":-0.044692755},"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Entire unit wheelchair accessible: 6 properties","depth":12,"bounds":{"left":0.6072141,"top":1.0,"width":0.0003324468,"height":-0.08459699},"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Roll-in shower: 1 property","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Emergency cord in bathroom: 1 property","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Shower chair: 1 property","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Walk-in shower: 13 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Raised toilet: 2 properties","depth":12,"on_screen":false,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Search results updated. Lozenets: 66 properties found. Sorted by: Top picks for long stays.","depth":9,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Lozenets: 66 properties found","depth":10,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"List","depth":10,"on_screen":false,"help_text":"","role_description":"radio button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"List","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Grid","depth":10,"on_screen":false,"help_text":"","role_description":"radio button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Grid","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Sort by: Top picks for long stays","depth":11,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Sort by:","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Top picks for long stays","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close banner","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Commission paid on bookings, and other factors can affect property rankings. Learn about these ranking parameters and how to select and modify them.","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Learn more","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Learn more","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Browse the results for Lozenets","depth":11,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save this item to a trip list","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Family Hotel Kontesa Opens in new window","depth":12,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXLink","text":"Family Hotel Kontesa Opens in new window","depth":13,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Family Hotel Kontesa","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Opens in new window","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"3 out of 5","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Lozenets·Show on map","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lozenets","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"·","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Show on map","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"·","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"100 m from downtown","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"·","depth":12,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Beach Nearby","depth":13,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"300 m from beach","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Scored 9.8 Exceptional 196 reviews","depth":11,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Scored 9.8","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exceptional","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"196 reviews","depth":14,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Comfort: Scored 9.8","depth":12,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Comfort","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"9.8","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Recommended for your group","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9082921408005096728
|
4436132614917977110
|
visual_change
|
accessibility
|
NULL
|
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
Getting Started DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
Getting Started · AFFiNE
Getting Started · AFFiNE
Screenpipe — Archive
Screenpipe — Archive
Download screenpipe — get started in minutes
Download screenpipe — get started in minutes
Self-Hosted Software and Apps
Self-Hosted Software and Apps
New Tab
New Tab
Помогнете ни да развиваме My Vivacom – Вашето мнение е важно - [EMAIL] - Gmail
Помогнете ни да развиваме My Vivacom – Вашето мнение е важно - [EMAIL] - Gmail
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Kontakt | Veľvyslanectvo Slovenskej republiky v Sofii
Kontakt | Veľvyslanectvo Slovenskej republiky v Sofii
Nginx Proxy Manager
Nginx Proxy Manager
Location Logger
Location Logger
Providers - Admin - authentik
Providers - Admin - authentik
Booking.com: Hotels in Lozenets. Book your hotel now!
Booking.com: Hotels in Lozenets. Book your hotel now!
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden
Skip to main content
Skip to main content
Booking.com
Prices in Euro
EUR
Language: English (US)
Customer support
List your property
List your property
Register an account
Register
Sign in
Sign in
Stays
Stays
Flights
Flights
Flight + Hotel
Flight + Hotel
Car rental
Car rental
Attractions
Attractions
Airport taxis
Airport taxis
Lozenets
Lozenets
Clear
Fri, Jun 26 — Sun, Jul 5
Fri, Jun 26
—
Sun, Jul 5
Number of travelers and rooms. Currently selected: 2 adults · 2 children · 1 room
2 adults · 2 children · 1 room
Search
Search
Home
Home
Bulgaria
Bulgaria
Burgas Province
Burgas Province
Lozenets
Lozenets
Search results
Show on map
Show on map
Filter by:
Filter by:
Your budget (per night)
€ 30 – € 400+
Popular filters
Beachfront: 26 properties
Swimming pool: 34 properties
Breakfast & dinner included: 1 property
Villas: 7 properties
Breakfast included: 14 properties
Free Wifi: 59 properties
Parking: 53 properties
Apartments: 25 properties
Smart filters
What are you looking for?
What are you looking for?
Find properties
Find properties
Meals
Breakfast included: 14 properties
Breakfast & dinner included: 1 property
Kitchen facilities: 40 properties
Property Type
Hotels: 23 properties
Apartments: 25 properties
Vacation Homes: 2 properties
Resorts: 2 properties
Villas: 7 properties
Resort Villages: 1 property
Guesthouses: 9 properties
Family-Friendly Properties: 15 properties
Entire homes & apartments: 44 properties
Bedrooms and bathrooms
Bedrooms
Bathrooms
Facilities
Swimming pool: 34 properties
Parking: 53 properties
Free Wifi: 59 properties
Spa: 6 properties
Hot tub/Jacuzzi: 9 properties
Show all 13
Show all 13
Room facilities
Kitchen/Kitchenette: 40 properties
Air conditioning: 62 properties
Sea view: 26 properties
Washing machine: 24 properties
Balcony: 57 properties
Show all 25
Show all 25
Beach Access
Beachfront: 26 properties
Review score
Wonderful: 9+: 35 properties
Very Good: 8+: 46 properties
Good: 7+: 53 properties
Pleasant: 6+: 55 properties
Property rating
Find high-quality hotels and vacation rentals
1 star: 5 properties
2 stars: 9 properties
3 stars: 23 properties
4 stars: 8 properties
5 stars: 1 property
Reservation policy
Free cancellation: 56 properties
Book without credit card: 1 property
Distance from center of Lozenets
Less than 1 km: 55 properties
Less than 3 km: 65 properties
Less than 5 km: 66 properties
Fun Things To Do
Beach: 39 properties
Tennis equipment: 11 properties
Private beach area: 15 properties
Playground: 19 properties
Windsurfing: 11 properties
Travel group
Pet friendly: 18 properties
Family-Friendly Properties: 15 properties
Bed preference
Cribs: 4 properties
Double bed: 60 properties
Twin beds: 31 properties
Highly rated features
Based on guest reviews
Very good breakfast: 1 property
Online Payment
Accepts online payments: 41 properties
Property Accessibility
Bathroom emergency cord: 1 property
Toilet with grab rails: 1 property
Lowered sink: 1 property
Room Accessibility
Entire unit located on ground floor: 12 properties
Upper floors accessible by elevator: 9 properties
Entire unit wheelchair accessible: 6 properties
Roll-in shower: 1 property
Emergency cord in bathroom: 1 property
Shower chair: 1 property
Walk-in shower: 13 properties
Raised toilet: 2 properties
Search results updated. Lozenets: 66 properties found. Sorted by: Top picks for long stays.
Lozenets: 66 properties found
List
List
Grid
Grid
Sort by: Top picks for long stays
Sort by:
Top picks for long stays
Close banner
Commission paid on bookings, and other factors can affect property rankings. Learn about these ranking parameters and how to select and modify them.
Learn more
Learn more
Browse the results for Lozenets
Save this item to a trip list
Family Hotel Kontesa Opens in new window
Family Hotel Kontesa Opens in new window
Family Hotel Kontesa
Opens in new window
3 out of 5
Lozenets·Show on map
Lozenets
·
Show on map
·
100 m from downtown
·
Beach Nearby
300 m from beach
Scored 9.8 Exceptional 196 reviews
Scored 9.8
Exceptional
196 reviews
Comfort: Scored 9.8
Comfort
9.8
Recommended for your group...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
82381
|
2855
|
0
|
2026-05-28T09:27:08.011388+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-28/1779 /Users/lukas/.screenpipe/data/data/2026-05-28/1779960428011_m2.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 5 Q2 - Platform Team - Scrum Board Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
[JY-20915] Add environment-specific email domains for text relay to prevent duplicate processing - Jira
Pipelines - jiminny/app
Pipelines - jiminny/app
BE upgrade libraries
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
Text relay
Feed — jiminny — Sentry
Feed — jiminny — Sentry
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
JY-20915 fix missing header by LakyLak · Pull Request #12136 · jiminny/app
JY-20915 fix missing header by LakyLak · Pull Request #12136 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
Login | Salesforce
Login | Salesforce
Jiminny\Exceptions\EmailActivityImportException: [Email Import] Failed for InboxEmail ID: 125695762: Error: Request failed — jiminny — app
Jiminny\Exceptions\EmailActivityImportException: [Email Import] Failed for InboxEmail ID: 125695762: Error: Request failed — jiminny — app
Jiminny Mail
Jiminny Mail
[JY-20979] Resolve PHP 8.5.5 deprications - Jira
[JY-20979] Resolve PHP 8.5.5 deprications - Jira
Jiminny
Jiminny
Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
Unnamed Group
Jiminny
Jiminny
[SRD-6881] [On demand] Transcription in saved search disappears - Jira
[SRD-6881] [On demand] Transcription in saved search disappears - Jira
Sona Subramanian at 27/05/2026, 17:46:08 - Session Replay - LogRocket
Sona Subramanian at 27/05/2026, 17:46:08 - Session Replay - LogRocket
Iliyana Netseva at 27/05/2026, 18:48:18 - Session Replay - LogRocket
Iliyana Netseva at 27/05/2026, 18:48:18 - Session Replay - LogRocket
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-20771-call-scoring-filter-for-exec-reports ■ 894578
75
75
432
activities
Get Notified
Sort by Sort by: Most recent
Sort by
Sort by:
Most recent
Add Recording
common.ai-icon-alt
Show internal and external activities:
Don't show internal
Customer questions:
6 to 50
Transcript:
price OR pay OR budget
Save Search
Clear all
Saved searches Saved searches
Saved searches
Saved searches
Team
Search teams Search teams
Search teams
Search teams
Host
Search team members Search team members
Search team members
Search team members
Also search as participant
Participant
Search team members Search team members
Search team members
Search team members
Customer
Customer
Transcript
price OR pay OR budget
Clear
Select option Said by
Select option
Said by
Select option Anyone
Select option
Anyone
Period...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.038065158,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"[JY-20915] Add environment-specific email domains for text relay to prevent duplicate processing - Jira","depth":4,"bounds":{"left":0.039893616,"top":0.0518755,"width":0.037898935,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"BE upgrade libraries","depth":4,"bounds":{"left":0.0028257978,"top":0.13288109,"width":0.03939495,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"[JY-20613] Allow owner's role to be selected when setting up a trial - Jira","depth":4,"bounds":{"left":0.0,"top":0.15203512,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20613] Allow owner's role to be selected when setting up a trial - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.1632083,"width":0.12799202,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Text relay","depth":4,"bounds":{"left":0.0028257978,"top":0.18994413,"width":0.020279255,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0028257978,"top":0.21348763,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.015957447,"top":0.22466081,"width":0.04288564,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"CloudWatch | us-east-2","depth":4,"bounds":{"left":0.0028257978,"top":0.2462091,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"CloudWatch | us-east-2","depth":5,"bounds":{"left":0.015957447,"top":0.25738227,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"CloudWatch | us-east-2","depth":4,"bounds":{"left":0.0028257978,"top":0.27893057,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"CloudWatch | us-east-2","depth":5,"bounds":{"left":0.015957447,"top":0.29010376,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"CloudWatch | us-east-2","depth":4,"bounds":{"left":0.0028257978,"top":0.31165203,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"CloudWatch | us-east-2","depth":5,"bounds":{"left":0.015957447,"top":0.32282522,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20915 fix missing header by LakyLak · Pull Request #12136 · jiminny/app","depth":4,"bounds":{"left":0.0028257978,"top":0.3443735,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20915 fix missing header by LakyLak · Pull Request #12136 · jiminny/app","depth":5,"bounds":{"left":0.015957447,"top":0.35554668,"width":0.1314827,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.37709498,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.38826814,"width":0.14245346,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Login | Salesforce","depth":4,"bounds":{"left":0.0,"top":0.40981644,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Login | Salesforce","depth":5,"bounds":{"left":0.013297873,"top":0.42098963,"width":0.030917553,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny\\Exceptions\\EmailActivityImportException: [Email Import] Failed for InboxEmail ID: 125695762: Error: Request failed — jiminny — app","depth":4,"bounds":{"left":0.0,"top":0.4425379,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny\\Exceptions\\EmailActivityImportException: [Email Import] Failed for InboxEmail ID: 125695762: Error: Request failed — jiminny — app","depth":5,"bounds":{"left":0.013297873,"top":0.4537111,"width":0.24301861,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.47525936,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.48643255,"width":0.02144282,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20979] Resolve PHP 8.5.5 deprications - Jira","depth":4,"bounds":{"left":0.0,"top":0.5079808,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20979] Resolve PHP 8.5.5 deprications - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.519154,"width":0.08543883,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.54070234,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5518755,"width":0.013131649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0,"top":0.5734238,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.584597,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Unnamed Group","depth":4,"bounds":{"left":0.0028257978,"top":0.6113328,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0028257978,"top":0.6348763,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.015957447,"top":0.6460495,"width":0.013297873,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6881] [On demand] Transcription in saved search disappears - Jira","depth":4,"bounds":{"left":0.0028257978,"top":0.6675978,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6881] [On demand] Transcription in saved search disappears - Jira","depth":5,"bounds":{"left":0.015957447,"top":0.67877096,"width":0.1271609,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sona Subramanian at 27/05/2026, 17:46:08 - Session Replay - LogRocket","depth":4,"bounds":{"left":0.0028257978,"top":0.70031923,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sona Subramanian at 27/05/2026, 17:46:08 - Session Replay - LogRocket","depth":5,"bounds":{"left":0.015957447,"top":0.7114924,"width":0.12799202,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Iliyana Netseva at 27/05/2026, 18:48:18 - Session Replay - LogRocket","depth":4,"bounds":{"left":0.0028257978,"top":0.7330407,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Iliyana Netseva at 27/05/2026, 18:48:18 - Session Replay - LogRocket","depth":5,"bounds":{"left":0.015957447,"top":0.7442139,"width":0.12134308,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.76576215,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.77693534,"width":0.013131649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.7729449,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.8000798,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20771-call-scoring-filter-for-exec-reports ■ 894578","depth":3,"bounds":{"left":0.08028591,"top":0.9860335,"width":0.1065492,"height":0.012769354},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"75","depth":6,"bounds":{"left":0.08228058,"top":0.91380686,"width":0.015957447,"height":0.035115723},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"75","depth":8,"bounds":{"left":0.09059176,"top":0.9173983,"width":0.004654255,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"432","depth":8,"bounds":{"left":0.2059508,"top":0.07063048,"width":0.013131649,"height":0.019553073},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"activities","depth":8,"bounds":{"left":0.21908244,"top":0.07063048,"width":0.026928192,"height":0.019553073},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Get Notified","depth":7,"bounds":{"left":0.93650264,"top":0.06584198,"width":0.043550532,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Sort by Sort by: Most recent","depth":7,"bounds":{"left":0.77543217,"top":0.065442935,"width":0.078125,"height":0.02952913},"on_screen":true,"value":"Sort by Sort by: Most recent","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Sort by","depth":8,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sort by:","depth":9,"bounds":{"left":0.7790891,"top":0.07342378,"width":0.016954787,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Most recent","depth":9,"bounds":{"left":0.7960439,"top":0.07342378,"width":0.025764627,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Recording","depth":7,"bounds":{"left":0.88547206,"top":0.06584198,"width":0.04837101,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"common.ai-icon-alt","depth":8,"bounds":{"left":0.98271275,"top":0.06464485,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Show internal and external activities:","depth":9,"bounds":{"left":0.20894282,"top":0.113727055,"width":0.06565824,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Don't show internal","depth":9,"bounds":{"left":0.2762633,"top":0.113727055,"width":0.03507314,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Customer questions:","depth":9,"bounds":{"left":0.32563165,"top":0.113727055,"width":0.036901597,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6 to 50","depth":9,"bounds":{"left":0.36419547,"top":0.113727055,"width":0.012466756,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Transcript:","depth":9,"bounds":{"left":0.39095744,"top":0.113727055,"width":0.019281914,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"price OR pay OR budget","depth":9,"bounds":{"left":0.4119016,"top":0.113727055,"width":0.042719416,"height":0.011971269},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save Search","depth":8,"bounds":{"left":0.46924868,"top":0.11173184,"width":0.033410903,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Clear all","depth":8,"bounds":{"left":0.50598407,"top":0.11173184,"width":0.025598405,"height":0.015961692},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Saved searches Saved searches","depth":7,"bounds":{"left":0.107546546,"top":0.06264964,"width":0.08643617,"height":0.028731046},"on_screen":true,"value":"Saved searches Saved searches","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Saved searches","depth":9,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Saved searches","depth":10,"bounds":{"left":0.111203454,"top":0.070231445,"width":0.03158245,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Team","depth":7,"bounds":{"left":0.107546546,"top":0.113727055,"width":0.011136968,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Search teams Search teams","depth":6,"bounds":{"left":0.107546546,"top":0.13248204,"width":0.08643617,"height":0.028731046},"on_screen":true,"value":"Search teams Search teams","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Search teams","depth":7,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search teams","depth":8,"bounds":{"left":0.111203454,"top":0.14006385,"width":0.027759308,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Host","depth":7,"bounds":{"left":0.107546546,"top":0.1707901,"width":0.009973404,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Search team members Search team members","depth":6,"bounds":{"left":0.107546546,"top":0.19233839,"width":0.08643617,"height":0.028731046},"on_screen":true,"value":"Search team members Search team members","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Search team members","depth":7,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search team members","depth":8,"bounds":{"left":0.111203454,"top":0.19992019,"width":0.045877658,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Also search as participant","depth":7,"bounds":{"left":0.107546546,"top":0.22505985,"width":0.053025264,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Participant","depth":7,"bounds":{"left":0.107546546,"top":0.25339186,"width":0.022938829,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Search team members Search team members","depth":6,"bounds":{"left":0.107546546,"top":0.27214685,"width":0.08643617,"height":0.028731046},"on_screen":true,"value":"Search team members Search team members","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Search team members","depth":7,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search team members","depth":8,"bounds":{"left":0.111203454,"top":0.27972865,"width":0.045877658,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Customer","depth":7,"bounds":{"left":0.107546546,"top":0.31165203,"width":0.021609042,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Customer","depth":6,"bounds":{"left":0.12017952,"top":0.3312051,"width":0.060837764,"height":0.028731046},"on_screen":true,"help_text":"","placeholder":"Customer or Subject","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transcript","depth":7,"bounds":{"left":0.107546546,"top":0.37031126,"width":0.022107713,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"price OR pay OR budget","depth":6,"bounds":{"left":0.12017952,"top":0.3926576,"width":0.060837764,"height":0.028731046},"on_screen":true,"value":"price OR pay OR budget","help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":true,"is_selected":false},{"role":"AXButton","text":"Clear","depth":6,"bounds":{"left":0.18168218,"top":0.39744613,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Select option Said by","depth":6,"bounds":{"left":0.107546546,"top":0.42617717,"width":0.08643617,"height":0.02952913},"on_screen":true,"value":"Select option Said by","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Select option","depth":7,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Said by","depth":8,"bounds":{"left":0.111203454,"top":0.43415803,"width":0.014793883,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Select option Anyone","depth":6,"bounds":{"left":0.107546546,"top":0.45969674,"width":0.08643617,"height":0.02952913},"on_screen":true,"value":"Select option Anyone","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Select option","depth":7,"on_screen":false,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Anyone","depth":8,"bounds":{"left":0.111203454,"top":0.46767756,"width":0.015957447,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Period","depth":7,"bounds":{"left":0.107546546,"top":0.5,"width":0.013796543,"height":0.013567438},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9082797055691163508
|
-575936271804074263
|
visual_change
|
accessibility
|
NULL
|
Platform Sprint 5 Q2 - Platform Team - Scrum Board Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
[JY-20915] Add environment-specific email domains for text relay to prevent duplicate processing - Jira
Pipelines - jiminny/app
Pipelines - jiminny/app
BE upgrade libraries
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
Text relay
Feed — jiminny — Sentry
Feed — jiminny — Sentry
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
CloudWatch | us-east-2
JY-20915 fix missing header by LakyLak · Pull Request #12136 · jiminny/app
JY-20915 fix missing header by LakyLak · Pull Request #12136 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
Login | Salesforce
Login | Salesforce
Jiminny\Exceptions\EmailActivityImportException: [Email Import] Failed for InboxEmail ID: 125695762: Error: Request failed — jiminny — app
Jiminny\Exceptions\EmailActivityImportException: [Email Import] Failed for InboxEmail ID: 125695762: Error: Request failed — jiminny — app
Jiminny Mail
Jiminny Mail
[JY-20979] Resolve PHP 8.5.5 deprications - Jira
[JY-20979] Resolve PHP 8.5.5 deprications - Jira
Jiminny
Jiminny
Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
Unnamed Group
Jiminny
Jiminny
[SRD-6881] [On demand] Transcription in saved search disappears - Jira
[SRD-6881] [On demand] Transcription in saved search disappears - Jira
Sona Subramanian at 27/05/2026, 17:46:08 - Session Replay - LogRocket
Sona Subramanian at 27/05/2026, 17:46:08 - Session Replay - LogRocket
Iliyana Netseva at 27/05/2026, 18:48:18 - Session Replay - LogRocket
Iliyana Netseva at 27/05/2026, 18:48:18 - Session Replay - LogRocket
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-20771-call-scoring-filter-for-exec-reports ■ 894578
75
75
432
activities
Get Notified
Sort by Sort by: Most recent
Sort by
Sort by:
Most recent
Add Recording
common.ai-icon-alt
Show internal and external activities:
Don't show internal
Customer questions:
6 to 50
Transcript:
price OR pay OR budget
Save Search
Clear all
Saved searches Saved searches
Saved searches
Saved searches
Team
Search teams Search teams
Search teams
Search teams
Host
Search team members Search team members
Search team members
Search team members
Also search as participant
Participant
Search team members Search team members
Search team members
Search team members
Customer
Customer
Transcript
price OR pay OR budget
Clear
Select option Said by
Select option
Said by
Select option Anyone
Select option
Anyone
Period...
|
82379
|
NULL
|
NULL
|
NULL
|
|
88022
|
3004
|
27
|
2026-05-28T16:38:37.285430+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-28/1779 /Users/lukas/.screenpipe/data/data/2026-05-28/1779986317285_m1.jpg...
|
PhpStorm
|
faVsco.js – console [EU]
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelp‹ >0 lol100% CDOCKER₴81DEV (-zsh)O 82Version 2023.11.20260427:Version 2023.11.20260505:Version2023.11.20260509:Version2023.11.20260511:Version2023.11.20260514:Version 2023.11.20260526:Run"/usr/bin/dnf check-release-update"#_####_\ #####\\###||\#/v~'Amazon Linux 2023 (ECS Optimized)-zshN3ec2-user@ip-10-20-31-146:~screenpipe"O &4-zshX5ec2-user@ip-10-30-129-...8• Thu 28 May 19:38:36181ec2-user@ip-10-20-31-1...·7for full release and version update infom/For documentation, visit [URL_WITH_CREDENTIALS] ~]$ docker exec -it $(docker ps --format "{{.ID}}" --filter "name-ecs-worker" | head -1) /bin/bash -c "cd /home/jiminny && bash"root@170a323e43a4:/home/jiminny# php artisan crm:sync-opportunity --teamId 555 --opportunityId 494058190045[2026-05-28 16:20:08] production.INF0: Jiminny\Console\Commands\Command: : run Memory usage before starting command {"command": "crm:sync-opportunity", "memoryBeforeCommandInMb" : 118.0, "memoryPeakBeforeCommandInMb":118.03 {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id":"1723bcBc-9f67-4ec7-b8c3-d09361d5879d"}Syncing opportunity for Cognitive Credit[2026-05-28 16:20:08] production.INFO: [SocialAccountService] Fetching token {"socialAccountId":30591,"provider": "hubspot"} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id":"1723bcDc-9f67-4ec7-b8c3-d09361d5879d"'}[2026-05-28 16:20:08] production.INFO: [SocialAccountService] Token retrieved {"socialAccountId":30591, "provider": "hubspot"} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id":"1723bc0c-9f67-4ec7-b8c3-d09361d5879d"'}[2026-05-28 16:20:08] production.INFO: [EncryptedTokenManager] Generatingaccess token. {"mode":"legacy"} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8","trace_id" :"1723bc0c-9f67-4ec7-b8c3-d09361d5879d"}Syncing opportunity 494058190045...[2026-05-28 16:20:08] production.INF0: [ReindexForOpportunityListener] Schedule reindexing job {"opportunity_id":7601423} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8","trace_id":"1723bc0c-9f67-4ec7-b8c3-d09361d5879d"}Synced Centiva Capital - EU HY/IG to 7601423[2026-05-28 16:20:08] production.INF0: Jiminny\Console\Commands\Command: :run Memory usage for command {"command": "crm:sync-opportunity", "memoryBeforeCommandInMb" : 118.0, "memoryAfterCommandInMB": 126.0, "memoryPeakBeforeCommandInMb" : 118.0, "memoryPeakAfterCommandInMB":126.0} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id" : "1723bc0c-9f67-4ec7-b8c3-d09361d5879d"}root@170a323e43a4:/home/jiminny# |...
|
NULL
|
9080944174981416166
|
NULL
|
click
|
ocr
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelp‹ >0 lol100% CDOCKER₴81DEV (-zsh)O 82Version 2023.11.20260427:Version 2023.11.20260505:Version2023.11.20260509:Version2023.11.20260511:Version2023.11.20260514:Version 2023.11.20260526:Run"/usr/bin/dnf check-release-update"#_####_\ #####\\###||\#/v~'Amazon Linux 2023 (ECS Optimized)-zshN3ec2-user@ip-10-20-31-146:~screenpipe"O &4-zshX5ec2-user@ip-10-30-129-...8• Thu 28 May 19:38:36181ec2-user@ip-10-20-31-1...·7for full release and version update infom/For documentation, visit [URL_WITH_CREDENTIALS] ~]$ docker exec -it $(docker ps --format "{{.ID}}" --filter "name-ecs-worker" | head -1) /bin/bash -c "cd /home/jiminny && bash"root@170a323e43a4:/home/jiminny# php artisan crm:sync-opportunity --teamId 555 --opportunityId 494058190045[2026-05-28 16:20:08] production.INF0: Jiminny\Console\Commands\Command: : run Memory usage before starting command {"command": "crm:sync-opportunity", "memoryBeforeCommandInMb" : 118.0, "memoryPeakBeforeCommandInMb":118.03 {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id":"1723bcBc-9f67-4ec7-b8c3-d09361d5879d"}Syncing opportunity for Cognitive Credit[2026-05-28 16:20:08] production.INFO: [SocialAccountService] Fetching token {"socialAccountId":30591,"provider": "hubspot"} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id":"1723bcDc-9f67-4ec7-b8c3-d09361d5879d"'}[2026-05-28 16:20:08] production.INFO: [SocialAccountService] Token retrieved {"socialAccountId":30591, "provider": "hubspot"} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id":"1723bc0c-9f67-4ec7-b8c3-d09361d5879d"'}[2026-05-28 16:20:08] production.INFO: [EncryptedTokenManager] Generatingaccess token. {"mode":"legacy"} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8","trace_id" :"1723bc0c-9f67-4ec7-b8c3-d09361d5879d"}Syncing opportunity 494058190045...[2026-05-28 16:20:08] production.INF0: [ReindexForOpportunityListener] Schedule reindexing job {"opportunity_id":7601423} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8","trace_id":"1723bc0c-9f67-4ec7-b8c3-d09361d5879d"}Synced Centiva Capital - EU HY/IG to 7601423[2026-05-28 16:20:08] production.INF0: Jiminny\Console\Commands\Command: :run Memory usage for command {"command": "crm:sync-opportunity", "memoryBeforeCommandInMb" : 118.0, "memoryAfterCommandInMB": 126.0, "memoryPeakBeforeCommandInMb" : 118.0, "memoryPeakAfterCommandInMB":126.0} {"correlation_id":"0a531c45-bc24-4ea8-b3c9-d90f79590da8", "trace_id" : "1723bc0c-9f67-4ec7-b8c3-d09361d5879d"}root@170a323e43a4:/home/jiminny# |...
|
88020
|
NULL
|
NULL
|
NULL
|
|
49091
|
1753
|
44
|
2026-05-15T11:21:19.248263+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-15/1778 /Users/lukas/.screenpipe/data/data/2026-05-15/1778844079248_m2.jpg...
|
PhpStorm
|
faVsco.js – UserAutomatedReportsController.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
14
2
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\API\UserAutomatedReports;
use Illuminate\Support\Carbon;
use Illuminate\Http\JsonResponse;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Responses\Api\Response;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\ApiResponseService;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
use Jiminny\Services\PlanhatService;
use Illuminate\Http\Request;
use Throwable;
class UserAutomatedReportsController extends Controller
{
public const int RESULTS_PER_PAGE = 25;
public const string SORT_COLUMN = 'sort_column';
public const string SORT_DIRECTION = 'sort_direction';
public function __construct(
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly AutomatedReportsService $automatedReportsService,
private readonly ApiResponseService $apiResponseService,
private readonly Response $response,
private readonly PlanhatService $planhatService,
) {
parent::__construct();
}
public function trackInterest(Request $request): JsonResponse
{
/** @var User $user */
$user = $request->user();
defer(
fn () => $this->planhatService->track(
user: $user,
event: 'automated-reports-track-interest',
)
)->always();
return $this->response->withOk();
}
/**
* @throws ApplicationException
*/
public function list(Request $request): JsonResponse
{
/** @var User $user */
$user = $request->user();
$teamIds = $request->has('team')
? (array) $request->get('team')
: [];
$reportTypes = $request->has('report_type')
? (array) $request->get('report_type')
: [];
$name = $request->has('name') ? trim($request->get('name', '')) : null;
try {
$fromDate = $request->has('from_date') ? Carbon::parse($request->get('from_date')) : null;
$toDate = $request->has('to_date') ? Carbon::parse($request->get('to_date')) : null;
} catch (\Exception) {
return $this->response->errorWrongArgs('Invalid date.');
}
$page = $request->has('page') ? (int) $request->get('page') : 1;
$sort = ReportSort::tryFrom(
$request->get(self::SORT_COLUMN, '')
) ?? ReportSort::GENERATED_AT;
$sortDirection = ReportSortDirection::tryFrom(
strtolower($request->get(self::SORT_DIRECTION, ''))
) ?? ReportSortDirection::DESC;
$paginatedUserReports = $this->automatedReportsRepository->getPaginatedUserReports(
user: $user,
sort: $sort,
sortDirection: $sortDirection,
resultsPerPage: self::RESULTS_PER_PAGE,
page: $page,
fromDate: $fromDate,
toDate: $toDate,
teamIds: array_map('intval', $teamIds),
reportTypes: $reportTypes,
name: $name,
);
$reportResults = $this->automatedReportsService->transformReportResults(
$paginatedUserReports->getCollection()
);
$team = $user->getTeam();
$reportTypeFilter = $this->automatedReportsService->getReportTypeFieldData(
shortVersion: true,
team: $team
);
$data = $this->apiResponseService->fromPaginatorToArray(
paginator: $paginatedUserReports,
data: $reportResults,
moreMeta: [
self::SORT_COLUMN => $sort->value,
self::SORT_DIRECTION => $sortDirection->value,
],
filters: [
$reportTypeFilter['id'] => $reportTypeFilter,
],
);
return $this->response->withArray($data);
}
public function delete(Request $request, string $uuid): JsonResponse
{
/** @var User $user */
$user = $request->user();
try {
$result = $this->automatedReportsRepository->findResultByUuidForUser($uuid, $user);
if ($result === null) {
return new JsonResponse(
data: ['error' => 'Report not found'],
status: JsonResponse::HTTP_NOT_FOUND
);
}
$result->delete();
return new JsonResponse(null, JsonResponse::HTTP_NO_CONTENT);
} catch (Throwable $e) {
return new JsonResponse(
data: ['error' => 'Failed to delete report result'],
status: JsonResponse::HTTP_INTERNAL_SERVER_ERROR
);
}
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
65
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id IN (32415, 32416);
# and id = 32412;
select * from users where team_id = 2 and email like '%scott%' and id = 29510;
SELECT * FROM activities WHERE uuid_to_bin('67cebfc2-ed56-44a2-8c68-7a0286ed8618') = uuid; # 79763436
SELECT email_provider_id, COUNT(*) as count, GROUP_CONCAT(id) as ids, GROUP_CONCAT(status) as statuses
FROM text_relays
WHERE email_provider_id IN ('19e2027868a64b42', '19e2033ed8ea6b10')
GROUP BY email_provider_id;
SELECT id, status, telephony_provider_id, created_at
FROM activities
WHERE id IN (80028719, 80028846);
SELECT id, status, code, email_sent_at, created_at, updated_at
FROM text_relays
WHERE id IN (32415, 32416);
SELECT id, status, code, sender, recipient, created_at
FROM text_relays
WHERE sender LIKE '%mario.georgiev%' OR sender LIKE '%stoyan.tomov%'
ORDER BY created_at DESC
LIMIT 10;
SELECT id, uuid, status, code, sender, recipient, created_at, updated_at
FROM text_relays
WHERE uuid = uuid_to_bin('0626141c-27a6-4d8c-aff8-7c8020a2c656');
# [PASSWORD_DOTS]
SELECT DISTINCT u.id, u.email, u.name, u.softphone_number, COUNT(a.id) as sms_count
FROM users u
INNER JOIN activities a ON u.id = a.user_id
WHERE a.type LIKE 'sms%'
# AND a.created_at > DATE_SUB(NOW(), INTERVAL 30 DAY)
GROUP BY u.id, u.email, u.name, u.softphone_number
ORDER BY sms_count DESC;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"pipedrive-sdk-poc, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.05618351,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: pipedrive-sdk-poc","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.32845744,"top":0.273743,"width":0.009640957,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.34009308,"top":0.273743,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.34973404,"top":0.27214685,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.3570479,"top":0.27214685,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\API\\UserAutomatedReports;\n\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Http\\JsonResponse;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Responses\\Api\\Response;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Services\\ApiResponseService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\nuse Jiminny\\Services\\PlanhatService;\nuse Illuminate\\Http\\Request;\nuse Throwable;\n\nclass UserAutomatedReportsController extends Controller\n{\n public const int RESULTS_PER_PAGE = 25;\n\n public const string SORT_COLUMN = 'sort_column';\n\n public const string SORT_DIRECTION = 'sort_direction';\n\n public function __construct(\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly AutomatedReportsService $automatedReportsService,\n private readonly ApiResponseService $apiResponseService,\n private readonly Response $response,\n private readonly PlanhatService $planhatService,\n ) {\n parent::__construct();\n }\n\n public function trackInterest(Request $request): JsonResponse\n {\n /** @var User $user */\n $user = $request->user();\n\n defer(\n fn () => $this->planhatService->track(\n user: $user,\n event: 'automated-reports-track-interest',\n )\n )->always();\n\n return $this->response->withOk();\n }\n\n /**\n * @throws ApplicationException\n */\n public function list(Request $request): JsonResponse\n {\n /** @var User $user */\n $user = $request->user();\n\n $teamIds = $request->has('team')\n ? (array) $request->get('team')\n : [];\n $reportTypes = $request->has('report_type')\n ? (array) $request->get('report_type')\n : [];\n $name = $request->has('name') ? trim($request->get('name', '')) : null;\n\n try {\n $fromDate = $request->has('from_date') ? Carbon::parse($request->get('from_date')) : null;\n $toDate = $request->has('to_date') ? Carbon::parse($request->get('to_date')) : null;\n } catch (\\Exception) {\n return $this->response->errorWrongArgs('Invalid date.');\n }\n\n $page = $request->has('page') ? (int) $request->get('page') : 1;\n $sort = ReportSort::tryFrom(\n $request->get(self::SORT_COLUMN, '')\n ) ?? ReportSort::GENERATED_AT;\n $sortDirection = ReportSortDirection::tryFrom(\n strtolower($request->get(self::SORT_DIRECTION, ''))\n ) ?? ReportSortDirection::DESC;\n\n $paginatedUserReports = $this->automatedReportsRepository->getPaginatedUserReports(\n user: $user,\n sort: $sort,\n sortDirection: $sortDirection,\n resultsPerPage: self::RESULTS_PER_PAGE,\n page: $page,\n fromDate: $fromDate,\n toDate: $toDate,\n teamIds: array_map('intval', $teamIds),\n reportTypes: $reportTypes,\n name: $name,\n );\n\n $reportResults = $this->automatedReportsService->transformReportResults(\n $paginatedUserReports->getCollection()\n );\n $team = $user->getTeam();\n $reportTypeFilter = $this->automatedReportsService->getReportTypeFieldData(\n shortVersion: true,\n team: $team\n );\n\n $data = $this->apiResponseService->fromPaginatorToArray(\n paginator: $paginatedUserReports,\n data: $reportResults,\n moreMeta: [\n self::SORT_COLUMN => $sort->value,\n self::SORT_DIRECTION => $sortDirection->value,\n ],\n filters: [\n $reportTypeFilter['id'] => $reportTypeFilter,\n ],\n );\n\n return $this->response->withArray($data);\n }\n\n public function delete(Request $request, string $uuid): JsonResponse\n {\n /** @var User $user */\n $user = $request->user();\n\n try {\n $result = $this->automatedReportsRepository->findResultByUuidForUser($uuid, $user);\n\n if ($result === null) {\n return new JsonResponse(\n data: ['error' => 'Report not found'],\n status: JsonResponse::HTTP_NOT_FOUND\n );\n }\n\n $result->delete();\n\n return new JsonResponse(null, JsonResponse::HTTP_NO_CONTENT);\n } catch (Throwable $e) {\n return new JsonResponse(\n data: ['error' => 'Failed to delete report result'],\n status: JsonResponse::HTTP_INTERNAL_SERVER_ERROR\n );\n }\n }\n}","depth":4,"bounds":{"left":0.13696809,"top":0.0,"width":0.22706117,"height":1.0},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Http\\Controllers\\API\\UserAutomatedReports;\n\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Http\\JsonResponse;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Http\\Controllers\\Controller;\nuse Jiminny\\Http\\Responses\\Api\\Response;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Services\\ApiResponseService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\nuse Jiminny\\Services\\PlanhatService;\nuse Illuminate\\Http\\Request;\nuse Throwable;\n\nclass UserAutomatedReportsController extends Controller\n{\n public const int RESULTS_PER_PAGE = 25;\n\n public const string SORT_COLUMN = 'sort_column';\n\n public const string SORT_DIRECTION = 'sort_direction';\n\n public function __construct(\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly AutomatedReportsService $automatedReportsService,\n private readonly ApiResponseService $apiResponseService,\n private readonly Response $response,\n private readonly PlanhatService $planhatService,\n ) {\n parent::__construct();\n }\n\n public function trackInterest(Request $request): JsonResponse\n {\n /** @var User $user */\n $user = $request->user();\n\n defer(\n fn () => $this->planhatService->track(\n user: $user,\n event: 'automated-reports-track-interest',\n )\n )->always();\n\n return $this->response->withOk();\n }\n\n /**\n * @throws ApplicationException\n */\n public function list(Request $request): JsonResponse\n {\n /** @var User $user */\n $user = $request->user();\n\n $teamIds = $request->has('team')\n ? (array) $request->get('team')\n : [];\n $reportTypes = $request->has('report_type')\n ? (array) $request->get('report_type')\n : [];\n $name = $request->has('name') ? trim($request->get('name', '')) : null;\n\n try {\n $fromDate = $request->has('from_date') ? Carbon::parse($request->get('from_date')) : null;\n $toDate = $request->has('to_date') ? Carbon::parse($request->get('to_date')) : null;\n } catch (\\Exception) {\n return $this->response->errorWrongArgs('Invalid date.');\n }\n\n $page = $request->has('page') ? (int) $request->get('page') : 1;\n $sort = ReportSort::tryFrom(\n $request->get(self::SORT_COLUMN, '')\n ) ?? ReportSort::GENERATED_AT;\n $sortDirection = ReportSortDirection::tryFrom(\n strtolower($request->get(self::SORT_DIRECTION, ''))\n ) ?? ReportSortDirection::DESC;\n\n $paginatedUserReports = $this->automatedReportsRepository->getPaginatedUserReports(\n user: $user,\n sort: $sort,\n sortDirection: $sortDirection,\n resultsPerPage: self::RESULTS_PER_PAGE,\n page: $page,\n fromDate: $fromDate,\n toDate: $toDate,\n teamIds: array_map('intval', $teamIds),\n reportTypes: $reportTypes,\n name: $name,\n );\n\n $reportResults = $this->automatedReportsService->transformReportResults(\n $paginatedUserReports->getCollection()\n );\n $team = $user->getTeam();\n $reportTypeFilter = $this->automatedReportsService->getReportTypeFieldData(\n shortVersion: true,\n team: $team\n );\n\n $data = $this->apiResponseService->fromPaginatorToArray(\n paginator: $paginatedUserReports,\n data: $reportResults,\n moreMeta: [\n self::SORT_COLUMN => $sort->value,\n self::SORT_DIRECTION => $sortDirection->value,\n ],\n filters: [\n $reportTypeFilter['id'] => $reportTypeFilter,\n ],\n );\n\n return $this->response->withArray($data);\n }\n\n public function delete(Request $request, string $uuid): JsonResponse\n {\n /** @var User $user */\n $user = $request->user();\n\n try {\n $result = $this->automatedReportsRepository->findResultByUuidForUser($uuid, $user);\n\n if ($result === null) {\n return new JsonResponse(\n data: ['error' => 'Report not found'],\n status: JsonResponse::HTTP_NOT_FOUND\n );\n }\n\n $result->delete();\n\n return new JsonResponse(null, JsonResponse::HTTP_NO_CONTENT);\n } catch (Throwable $e) {\n return new JsonResponse(\n data: ['error' => 'Failed to delete report result'],\n status: JsonResponse::HTTP_INTERNAL_SERVER_ERROR\n );\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.36569148,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.3743351,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.38530585,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.39394948,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.40259308,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.41356382,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.4245346,"top":0.09896249,"width":0.024268618,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.45113033,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.46210107,"top":0.09896249,"width":0.029587766,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.60206115,"top":0.09896249,"width":0.02825798,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"40","depth":4,"bounds":{"left":0.57147604,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.5837766,"top":0.123703115,"width":0.00731383,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"40","depth":4,"bounds":{"left":0.5930851,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"65","depth":4,"bounds":{"left":0.60538566,"top":0.123703115,"width":0.010305851,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.61735374,"top":0.12210695,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6246675,"top":0.12210695,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id IN (32415, 32416);\n# and id = 32412;\n\nselect * from users where team_id = 2 and email like '%scott%' and id = 29510;\n\nSELECT * FROM activities WHERE uuid_to_bin('67cebfc2-ed56-44a2-8c68-7a0286ed8618') = uuid; # 79763436\n\nSELECT email_provider_id, COUNT(*) as count, GROUP_CONCAT(id) as ids, GROUP_CONCAT(status) as statuses\nFROM text_relays\nWHERE email_provider_id IN ('19e2027868a64b42', '19e2033ed8ea6b10')\nGROUP BY email_provider_id;\nSELECT id, status, telephony_provider_id, created_at\nFROM activities\nWHERE id IN (80028719, 80028846);\nSELECT id, status, code, email_sent_at, created_at, updated_at\nFROM text_relays\nWHERE id IN (32415, 32416);\nSELECT id, status, code, sender, recipient, created_at\nFROM text_relays\nWHERE sender LIKE '%mario.georgiev%' OR sender LIKE '%stoyan.tomov%'\nORDER BY created_at DESC\nLIMIT 10;\n\nSELECT id, uuid, status, code, sender, recipient, created_at, updated_at\nFROM text_relays\nWHERE uuid = uuid_to_bin('0626141c-27a6-4d8c-aff8-7c8020a2c656');\n\n# ***************\nSELECT DISTINCT u.id, u.email, u.name, u.softphone_number, COUNT(a.id) as sms_count\nFROM users u\nINNER JOIN activities a ON u.id = a.user_id\nWHERE a.type LIKE 'sms%'\n# AND a.created_at > DATE_SUB(NOW(), INTERVAL 30 DAY)\nGROUP BY u.id, u.email, u.name, u.softphone_number\nORDER BY sms_count DESC;","depth":4,"on_screen":true,"value":"SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993\nSELECT * FROM users WHERE id = 25061;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 994;\nSELECT * FROM crm_profiles WHERE user_id = 25061;\n\nselect * from crm_configurations where id = 834;\nSELECT * FROM teams WHERE id = 882;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;\n\nSELECT * FROM contacts where crm_configuration_id = 834;\nSELECT * FROM opportunities WHERE team_id = 933\n# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');\nAND id IN (8482561,18352941,19042734,19232139,19445140,19472541);\nSELECT * FROM opportunity_contacts\nWHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 485; #\nSELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\nselect crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id\nwhere crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')\n# and l.converted_at IS NOT NULL\n;\n\n# ********************************************************************\nSELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')\nand opportunity_id IS NULL\norder by id desc;\n\nSELECT * FROM teams WHERE id = 604; # 598\nSELECT * FROM activities WHERE id = 74410828; # chelseaw@allvoices.co\nSELECT * FROM accounts WHERE id = 20068382;\nSELECT * FROM accounts WHERE id = 35186038;\n\nSELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 559 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;\nselect * from sidekick_settings where team_id = 781;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100\n\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 711;\nSELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL\nand is_internal = 0 and status = 'completed'\norder by id desc;\n\nSELECT * FROM crm_layout_entities\nWHERE crm_layout_id IN (2352, 2353);\n;\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 556 and sa.provider = 'hubspot';\n\nSELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;\nSELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;\nselect * from contacts\nwhere crm_configuration_id = 530\nand crm_provider_id = 872252;\n\nselect * from activities where crm_configuration_id = 530\nand user_id = 14343 and type like '%softphone%'\nand created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';\n\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya\nSELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);\n\n\nSELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t\nJOIN crm_configurations c ON t.id = c.team_id\nWHERE t.status = 'active';\n\nSELECT * FROM teams where id = 1091;\nSELECT * FROM crm_configurations where team_id = 1091;\nSELECT * FROM activity_providers where team_id = 1091;\nSELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT * FROM teams WHERE name LIKE '%Leadventure%';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1091 and sa.provider = 'salesforce';\n\nSELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812\nSELECT * FROM teams where id = 862;\nSELECT * FROM crm_configurations where team_id = 862;\nSELECT * FROM activity_providers where team_id = 862;\nSELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')\nand provider NOT IN ('hubspot', 'aircall')\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by id desc;\n\n\nSELECT t.id, crm.id, crm.provider, ap.* FROM teams t\njoin crm_configurations crm on t.id = crm.team_id\njoin activity_providers ap on t.id = ap.team_id\nwhere t.status = 'active' and ap.is_enabled = 1\nand crm.provider = 'hubspot'\nand ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',\n 'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');\n\nSELECT * FROM teams where id = 1068;\nSELECT * FROM crm_configurations where team_id = 1068;\nSELECT * FROM activity_providers where team_id = 1068;\n\nSELECT * FROM activities a\nwhere crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')\nand a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'\n )\n# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'\norder by a.id desc;\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1068 and sa.provider = 'hubspot';\n\n# ********************************************************************\n# ********************************************************************\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 933 and sa.provider = 'hubspot';\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262\nSELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 882 and sa.provider = 'hubspot';\nselect * from crm_layouts where crm_configuration_id = 834;\nselect * from crm_layout_entities where crm_layout_id = 2780;\nselect * from crm_fields where id IN (321153,321192,321193,321194);\n\nSELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1057 and sa.provider = 'hubspot';\n\nSELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8\n\nSELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20\n\nSELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last\n\nSELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10\n\nSELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2\n\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;\n\nSELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th\n# ********************************************************************\nSELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #\n\nSELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;\nselect * from users where team_id = 51; # 7783\nSELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130\nselect * from activity_searches where user_id = 7783;\nselect * from activity_search_filters where activity_search_id IN (32291, 32292);\n\nSELECT asf.activity_search_id, asf.id, asf.value\nFROM activity_search_filters asf\nWHERE asf.filter = 'group_id'\nAND asf.value IN (\n SELECT CONCAT(\n HEX(SUBSTR(uuid, 5, 4)), '-',\n HEX(SUBSTR(uuid, 3, 2)), '-',\n HEX(SUBSTR(uuid, 1, 2)), '-',\n HEX(SUBSTR(uuid, 9, 2)), '-',\n HEX(SUBSTR(uuid, 11))\n )\n FROM groups\n WHERE deleted_at IS NOT NULL\n);\n\nSELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th\n# ********************************************************************\nSELECT * FROM crm_configurations where provider = 'hubspot';\nSELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133\nSELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;\nSELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null\n# ********************************************************************\n\nselect * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';\nselect\n cp.*\n# DISTINCT t.id\n# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields\nFROM crm_profiles cp\nJOIN crm_configurations crm on crm.id = cp.crm_configuration_id\nJOIN users u on u.id = cp.user_id\nJOIN teams t ON t.id = crm.team_id\nWHERE crm.provider = 'salesforce' and t.status = 'active'\n and cp.archived_at IS NULL and u.deleted_at IS NULL\n and t.id NOT IN (1093)\n and t.id = 2\n and cp.contact_fields IS NULL;\n# and c.crm_provider_id = '003Uu00000ojD4NIAU';\n\nSELECT * FROM users WHERE id = 26484;\nSELECT * FROM crm_profiles WHERE user_id = 26484;\nSELECT * FROM social_accounts WHERE sociable_id = 26484;\nSELECT * FROM crm_configurations where provider = 'salesforce';\nselect * from users where id IN (10022, 10403);\nselect * from users where team_id IN (526);\nselect * from teams where id IN (526, 532);\nselect * from crm_configurations where id IN (500, 516);\nselect * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);\nselect * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 526 and sa.provider = 'salesforce';\nselect * from team_settings where team_id IN (526, 532);\n\nselect * from users where id IN (22824);\nselect * from crm_profiles where crm_configuration_id IN (1026);\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1093 and sa.provider = 'salesforce';\n\nselect * from teams where id = 1099;\nselect * from users where id = 29643\n\nselect * from activity_processing_states;\n\nSELECT * FROM teams where name LIKE '%Fare%'; # 233\nSELECT * FROM opportunities where crm_configuration_id = 215\n# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'\n;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1088 and sa.provider = 'hubspot';\n\nSELECT * FROM teams order by updated_at DESC\nSELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account\n\nselect * from crm_configurations where provider = 'pipedrive';\n\nselect * from teams where id = 957;\nselect * from crm_configurations where id = 957;\n\nSELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743\nSELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;\n\nselect * from users where team_id = 1; # 26726 - Gabriela Dureva\nSELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific\nselect * from activities where user_id = 26726 order by id desc;\nselect * from contacts where crm_configuration_id = 1\nand email IN ('charlotte.ward@prolific.com', 'frankie.bryant@prolific.com'); # 2094416, 2093620\nSELECT * FROM contacts WHERE id = 6284931;\n\nSELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id\nWHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;\n\nselect * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);\nselect * from crm_configurations where id = 1;\n\n43801692-1aeb-32ce-acba-5b80a479701a\n44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b\n405975c0-b3d0-7aaa-821f-09d59cae6dd1\n4caf848d-4bed-2299-b248-7788d41f9fca\n49bedc3f-f196-eef3-89c3-dea6a3b4aa63\n43420989-a09d-b8f8-9806-c8bbf7a02aac\n\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nSELECT * FROM activities WHERE id = 75461988;\n\nSELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;\n\nselect * from contacts where id = 17900517;\n\nselect * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id\nwhere crm.provider != 'salesforce';\n\nselect * from users where id = 21047;\nSELECT * FROM crm_configurations WHERE id = 892;\nSELECT * FROM teams WHERE id = 942;\nselect * from opportunities where team_id = 942 order by updated_at desc;\nselect * from contacts where team_id = 942 order by updated_at desc;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 942 and sa.provider = 'hubspot';\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430\nSELECT * FROM crm_configurations WHERE id = 1;\nSELECT * FROM teams WHERE crm_id = 1;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1 and sa.provider = 'salesforce';\n\nselect id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1\nSELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430\n\nselect * from teams where id = 852;\nselect * from groups where id = 2286;\nselect * from sidekick_settings where team_id = 852;\nselect * from default_activity_types where team_id = 852;\n\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1 AND u.deleted_at IS NULL\nAND u.crm_required = 1\nAND u.team_id = 1\nORDER BY u.team_id;\n\nSELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (\n18481\n );\n\nSELECT cc.provider, cc.id, p.id, u.*\nFROM users u\nLEFT JOIN crm_profiles p ON u.id = p.user_id\nINNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'\nINNER JOIN crm_configurations cc ON t.crm_id = cc.id\nWHERE u.status = 1\n AND u.deleted_at IS NULL\n AND u.crm_required = 1\n# AND u.team_id = 1\n AND p.id IS NULL -- Move this condition to WHERE clause\nORDER BY u.team_id;\n\nSELECT * FROM opportunities WHERE id = 20002609;\nselect * from teams where id = 1122; # Velatir, 29953 - christian@velatir.com\nselect * from crm_configurations where id = 1060;\nselect * from crm_layouts where crm_configuration_id = 1060;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1122 and sa.provider = 'hubspot';\nselect * from opportunities where team_id = 1122 order by updated_at desc;\n\nselect * from crm_field_data where object_type = 'contact';\n\nSELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 248 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS\nSELECT * FROM users where id = 24115;\nSELECT * FROM accounts where id = 4002896;\nSELECT * FROM teams WHERE name LIKE '%adswerve%';\nSELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN (\"0069N000003GIQ9QAO\",\"0061r000019yGP9AAM\",\"0066900001S2KWlAAN\",\"0066900001TDpj2AAD\",\"0066900001b8uEwAAI\",\"0069N000001rQi0QAE\",\"006QF00000KD40mYAD\",\"006QF00000LzpRJYAZ\",\"0069N000002uomtQAA\",\"0069N000002xlMLQAY\",\"0066900001NV6ubAAD\",\"0061r00001HJp45AAD\",\"006QF00000uTlUoYAK\",\"006QF00000v0bZqYAI\");\nSELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203\n\nSELECT u.id, u.email, ac.name, a.* FROM activities a\nJOIN users u ON a.user_id = u.id\nJOIN accounts ac ON a.account_id = ac.id\nWHERE\nuuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or\nuuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or\nuuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;\n\nselect * from users where id = 5825;\nSELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;\n\nselect * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;\n19594, 862\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 862 and sa.provider = 'salesforce';\n\nselect * from automated_reports where id = 36;\nselect ar.frequency, r.*, ar.* from automated_report_results r\njoin automated_reports ar on r.report_id = ar.id\nwhere ar.frequency != 'one_off';\n\nselect s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;\nselect * from nudges n where n.activity_search_id\n\nselect * from teams where created_at > '2026-03-09';\nSELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;\n\nselect * from users where team_id = 1 and name like '%Lukas%'; # 7160\n\nSELECT * FROM teams WHERE id = 575;\nselect * from opportunities where team_id = 575;\nSELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,\nselect * from opportunities where team_id = 1126;\nSELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,\nselect * from opportunities where team_id = 1125;\nselect * from contacts c\nwhere c.team_id = 882;\n\nSELECT * FROM activities WHERE id = 76822967;\nSELECT * FROM crm_profiles WHERE user_id = 15440;\nSELECT * FROM crm_profiles WHERE crm_configuration_id = 555;\nSELECT * FROM crm_configurations WHERE id = 555;\nSELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 581 and sa.provider = 'salesforce';\n\nSELECT * FROM automated_report_results order by id desc;\n\nselect * from features;\nselect * from team_features where feature_id = 40;\n\nselect * from teams where id = 556;\n\nselect * from automated_reports;\nwhere id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , [\"pdf\",\"podcast\"]\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\nselect * from automated_report_results order by id desc;\nSELECT * FROM automated_report_results WHERE id = 1919;\n\nselect * from automated_report_results WHERE report_id = 54;\n\nselect * from opportunities where id = 7594349;\n\nSELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - jiminnyintegration@lesmills.com\nselect * from playbooks where team_id = 711; # event 226147\nSELECT * FROM playbook_categories WHERE playbook_id = 5515;\nSELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';\nSELECT * FROM crm_fields WHERE id = 226147;\nSELECT * FROM crm_field_values WHERE crm_field_id = 226147;\n\nSELECT * FROM crm_configurations WHERE id = 692;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 711 and sa.provider = 'salesforce';\n\nSELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;\n\nselect * from leads;\n\nselect * from calendars;\n\nSELECT\n t.id AS team_id,\n t.name,\n LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain\nFROM teams t\nJOIN users u ON u.team_id = t.id\nJOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'\nLEFT JOIN team_domains td\n ON td.team_id = t.id\n AND td.deleted_at IS NULL\n AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))\nGROUP BY t.id, t.name, calendar_domain\nORDER BY t.name, calendar_domain;\n\nselect * from users u join calendars c on c.user_id = u.id\nwhere u.team_id = 882;\n\n\nselect * from activities where id = 74049485; # team 563 crm 537\nselect * from activities where id = 73272382; # team 563 crm 537\nselect * from activities where id = 64400389; # team 563 crm 537\nselect * from activities where id = 58081273; # team 563 crm 537\nselect * from activities where id = 54520297; # team 563 crm 537\nselect * from participants where activity_id = 58081273;\n\nselect * from activities where crm_configuration_id = 537 and provider = 'aircall'\nand account_id = 19003658 order by updated_at desc;\n\nselect * from contacts where crm_configuration_id = 537 and id = 35957759;\nselect * from accounts where crm_configuration_id = 537 and id = 19003658;\n\nselect * from automated_report_results where id = 1976;\nselect * from automated_reports where id = 583;\nselect * from activity_searches where id = 87714;\nselect * from activity_search_filters where activity_search_id = 87714;\n\nSELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid\nor uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;\n\nSELECT * FROM crm_configurations WHERE provider = 'hubspot';\nselect * from rate_limits;\n\nselect * from automated_report_results where media_type = 'pdf' and status = 2\nand id IN (18, 1872);\nselect * from automated_reports where id = 54;\nSELECT * FROM users WHERE id IN (24623,29443,29613);\n\nSELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;\n\nselect * from text_relays where created_at > '2026-05-01'\nand id IN (32415, 32416);\n# and id = 32412;\n\nselect * from users where team_id = 2 and email like '%scott%' and id = 29510;\n\nSELECT * FROM activities WHERE uuid_to_bin('67cebfc2-ed56-44a2-8c68-7a0286ed8618') = uuid; # 79763436\n\nSELECT email_provider_id, COUNT(*) as count, GROUP_CONCAT(id) as ids, GROUP_CONCAT(status) as statuses\nFROM text_relays\nWHERE email_provider_id IN ('19e2027868a64b42', '19e2033ed8ea6b10')\nGROUP BY email_provider_id;\nSELECT id, status, telephony_provider_id, created_at\nFROM activities\nWHERE id IN (80028719, 80028846);\nSELECT id, status, code, email_sent_at, created_at, updated_at\nFROM text_relays\nWHERE id IN (32415, 32416);\nSELECT id, status, code, sender, recipient, created_at\nFROM text_relays\nWHERE sender LIKE '%mario.georgiev%' OR sender LIKE '%stoyan.tomov%'\nORDER BY created_at DESC\nLIMIT 10;\n\nSELECT id, uuid, status, code, sender, recipient, created_at, updated_at\nFROM text_relays\nWHERE uuid = uuid_to_bin('0626141c-27a6-4d8c-aff8-7c8020a2c656');\n\n# ***************\nSELECT DISTINCT u.id, u.email, u.name, u.softphone_number, COUNT(a.id) as sms_count\nFROM users u\nINNER JOIN activities a ON u.id = a.user_id\nWHERE a.type LIKE 'sms%'\n# AND a.created_at > DATE_SUB(NOW(), INTERVAL 30 DAY)\nGROUP BY u.id, u.email, u.name, u.softphone_number\nORDER BY sms_count DESC;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9080188367640938582
|
2218652917440067141
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
pipedrive-sdk-poc, menu
S Project: faVsco.js, menu
pipedrive-sdk-poc, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
14
2
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Http\Controllers\API\UserAutomatedReports;
use Illuminate\Support\Carbon;
use Illuminate\Http\JsonResponse;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Http\Controllers\Controller;
use Jiminny\Http\Responses\Api\Response;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\ApiResponseService;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
use Jiminny\Services\PlanhatService;
use Illuminate\Http\Request;
use Throwable;
class UserAutomatedReportsController extends Controller
{
public const int RESULTS_PER_PAGE = 25;
public const string SORT_COLUMN = 'sort_column';
public const string SORT_DIRECTION = 'sort_direction';
public function __construct(
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly AutomatedReportsService $automatedReportsService,
private readonly ApiResponseService $apiResponseService,
private readonly Response $response,
private readonly PlanhatService $planhatService,
) {
parent::__construct();
}
public function trackInterest(Request $request): JsonResponse
{
/** @var User $user */
$user = $request->user();
defer(
fn () => $this->planhatService->track(
user: $user,
event: 'automated-reports-track-interest',
)
)->always();
return $this->response->withOk();
}
/**
* @throws ApplicationException
*/
public function list(Request $request): JsonResponse
{
/** @var User $user */
$user = $request->user();
$teamIds = $request->has('team')
? (array) $request->get('team')
: [];
$reportTypes = $request->has('report_type')
? (array) $request->get('report_type')
: [];
$name = $request->has('name') ? trim($request->get('name', '')) : null;
try {
$fromDate = $request->has('from_date') ? Carbon::parse($request->get('from_date')) : null;
$toDate = $request->has('to_date') ? Carbon::parse($request->get('to_date')) : null;
} catch (\Exception) {
return $this->response->errorWrongArgs('Invalid date.');
}
$page = $request->has('page') ? (int) $request->get('page') : 1;
$sort = ReportSort::tryFrom(
$request->get(self::SORT_COLUMN, '')
) ?? ReportSort::GENERATED_AT;
$sortDirection = ReportSortDirection::tryFrom(
strtolower($request->get(self::SORT_DIRECTION, ''))
) ?? ReportSortDirection::DESC;
$paginatedUserReports = $this->automatedReportsRepository->getPaginatedUserReports(
user: $user,
sort: $sort,
sortDirection: $sortDirection,
resultsPerPage: self::RESULTS_PER_PAGE,
page: $page,
fromDate: $fromDate,
toDate: $toDate,
teamIds: array_map('intval', $teamIds),
reportTypes: $reportTypes,
name: $name,
);
$reportResults = $this->automatedReportsService->transformReportResults(
$paginatedUserReports->getCollection()
);
$team = $user->getTeam();
$reportTypeFilter = $this->automatedReportsService->getReportTypeFieldData(
shortVersion: true,
team: $team
);
$data = $this->apiResponseService->fromPaginatorToArray(
paginator: $paginatedUserReports,
data: $reportResults,
moreMeta: [
self::SORT_COLUMN => $sort->value,
self::SORT_DIRECTION => $sortDirection->value,
],
filters: [
$reportTypeFilter['id'] => $reportTypeFilter,
],
);
return $this->response->withArray($data);
}
public function delete(Request $request, string $uuid): JsonResponse
{
/** @var User $user */
$user = $request->user();
try {
$result = $this->automatedReportsRepository->findResultByUuidForUser($uuid, $user);
if ($result === null) {
return new JsonResponse(
data: ['error' => 'Report not found'],
status: JsonResponse::HTTP_NOT_FOUND
);
}
$result->delete();
return new JsonResponse(null, JsonResponse::HTTP_NO_CONTENT);
} catch (Throwable $e) {
return new JsonResponse(
data: ['error' => 'Failed to delete report result'],
status: JsonResponse::HTTP_INTERNAL_SERVER_ERROR
);
}
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
40
1
40
65
Previous Highlighted Error
Next Highlighted Error
SELECT * FROM teams WHERE name LIKE '%litify%'; # 1069, 994, 24993
SELECT * FROM users WHERE id = 25061;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 994;
SELECT * FROM crm_profiles WHERE user_id = 25061;
select * from crm_configurations where id = 834;
SELECT * FROM teams WHERE id = 882;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations WHERE provider = 'hubspot' and crm_provider_id = 7270388;
SELECT * FROM contacts where crm_configuration_id = 834;
SELECT * FROM opportunities WHERE team_id = 933
# AND crm_provider_id IN ('20131586060','46017317898','52543911090','53451356564','54101251892','54323768459');
AND id IN (8482561,18352941,19042734,19232139,19445140,19472541);
SELECT * FROM opportunity_contacts
WHERE opportunity_id IN (8482561,18352941,19042734,19232139,19445140,19472541);
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 485; #
SELECT * FROM opportunities WHERE team_id = 933 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
select crm.provider, l.* from leads l join crm_configurations crm on l.crm_configuration_id = crm.id
where crm.provider NOT IN ('salesforce', 'integration-app', 'bullhorn', 'copper')
# and l.converted_at IS NOT NULL
;
# [PASSWORD_DOTS]
SELECT * FROM activities a WHERE type IN ('email-inbound', 'email-outbound')
and opportunity_id IS NULL
order by id desc;
SELECT * FROM teams WHERE id = 604; # 598
SELECT * FROM activities WHERE id = 74410828; # [EMAIL]
SELECT * FROM accounts WHERE id = 20068382;
SELECT * FROM accounts WHERE id = 35186038;
SELECT * FROM contacts WHERE team_id = 852 and updated_at > '2026-01-23 12:30:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 559 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('cb6342b6-a183-401c-b0af-ede92b2ae763') = uuid;
select * from sidekick_settings where team_id = 781;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 26651871; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 7562435;
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8420347; # opflit 2100
SELECT * FROM crm_layouts WHERE crm_configuration_id = 711;
SELECT * FROM activities where crm_configuration_id = 711 and crm_provider_id IS NULL
and is_internal = 0 and status = 'completed'
order by id desc;
SELECT * FROM crm_layout_entities
WHERE crm_layout_id IN (2352, 2353);
;
SELECT * FROM crm_configurations where provider = 'hubspot' and id = 530;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 556 and sa.provider = 'hubspot';
SELECT * FROM activities WHERE uuid_to_bin('c6ca4b22-7738-4563-a95d-b8a9598924ae') = uuid;
SELECT * FROM activities WHERE uuid_to_bin('442abb2b-28bd-4be8-9c25-19e9bf02766d') = uuid;
select * from contacts
where crm_configuration_id = 530
and crm_provider_id = 872252;
select * from activities where crm_configuration_id = 530
and user_id = 14343 and type like '%softphone%'
and created_at between '2026-01-28 15:00:00' and '2026-01-28 15:10:00';
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 25666868; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id = 8646335; # Teya
SELECT * FROM crm_configurations where provider = 'hubspot' and crm_provider_id IN (5933397);
SELECT t.name, t.id, t.owner_id, c.id, c.provider, c.crm_base_url FROM teams t
JOIN crm_configurations c ON t.id = c.team_id
WHERE t.status = 'active';
SELECT * FROM teams where id = 1091;
SELECT * FROM crm_configurations where team_id = 1091;
SELECT * FROM activity_providers where team_id = 1091;
SELECT * FROM activities where crm_configuration_id = 1024 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT * FROM teams WHERE name LIKE '%Leadventure%';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1091 and sa.provider = 'salesforce';
SELECT * FROM teams WHERE name LIKE '%Wilson%'; # 862, 812
SELECT * FROM teams where id = 862;
SELECT * FROM crm_configurations where team_id = 862;
SELECT * FROM activity_providers where team_id = 862;
SELECT * FROM activities where crm_configuration_id = 812 and type IN ('softphone', 'softphone-outbound')
and provider NOT IN ('hubspot', 'aircall')
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by id desc;
SELECT t.id, crm.id, crm.provider, ap.* FROM teams t
join crm_configurations crm on t.id = crm.team_id
join activity_providers ap on t.id = ap.team_id
where t.status = 'active' and ap.is_enabled = 1
and crm.provider = 'hubspot'
and ap.provider NOT IN ('hubspot', 'aircall', 'uploader', 'gong', 'twilio', 'zoom-bot', 'google-meet', 'ms-teams',
'outreach', 'close', 'ringcentral', 'dialpad', 'zoom-phone');
SELECT * FROM teams where id = 1068;
SELECT * FROM crm_configurations where team_id = 1068;
SELECT * FROM activity_providers where team_id = 1068;
SELECT * FROM activities a
where crm_configuration_id = 993 and type IN ('softphone', 'softphone-outbound')
and a.provider NOT IN ('hubspot', 'uploader', 'gong', 'twilio', 'google-meet', 'ms-teams','close'
)
# and telephony_provider_id = '019c1131-a22f-4792-b9ea-20adf6a02ed0'
order by a.id desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1068 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 882; # 933 - GoGlobal , portalId: 6017093
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 933 and updated_at > '2026-02-06 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 933 and sa.provider = 'hubspot';
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 834; # 882 - AnyVan , portalId: 5468262
SELECT * FROM contacts WHERE crm_configuration_id = 834 and updated_at > '2026-03-30 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and updated_at > '2026-03-04 08:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 882 and sa.provider = 'hubspot';
select * from crm_layouts where crm_configuration_id = 834;
select * from crm_layout_entities where crm_layout_id = 2780;
select * from crm_fields where id IN (321153,321192,321193,321194);
SELECT * FROM opportunities WHERE crm_configuration_id = 834 and id = 10993426;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 988; # 1057 - Teya (543ce4f4-168c-4571-91ea-5b35c253f06f) , portalId: 26651871
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1057 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1057 and sa.provider = 'hubspot';
SELECT * FROM crm_configurations where id = 533; # 559 - Connectd , portalId: 6710988
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 559 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 801; # 852 - Rise Vision , portalId: 2700250
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 852 and updated_at > '2026-02-04 00:00:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 962; # 1034 - evergrowth.io , portalId: 143180990
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1034 and updated_at > '2026-02-04 00:00:00' order by updated_at desc;
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 1037; # 1102 - Jibble , portalId: 6649755
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1102 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 8
SELECT * FROM crm_configurations where id = 1015; # 1049 - Travefy , portalId: 48904401
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1049 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 20
SELECT * FROM crm_configurations where id = 64; # 70 - SalaryFinance , portalId: 3404115
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 70 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 6th last
SELECT * FROM crm_configurations where id = 802; # 853 - Street Group , portalId: 7658438
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 853 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 10
SELECT * FROM crm_configurations where id = 872; # 921 - In Professional Development , portalId: 9238273
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 921 and updated_at > '2026-02-04 12:30:00' order by updated_at desc; # 2
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 550; # 576 - SeedLegals , portalId: 3028661
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 576 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 989; # 1058 - rtaoutdoor.com , portalId: 22371204
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1058 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 896; # 946 - Mintago , portalId: 6621281
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 946 and updated_at > '2026-02-05 14:00:00' order by updated_at desc;
SELECT * FROM crm_configurations where id = 617; # 641 - PCS , portalId: 5244937
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 641 and updated_at > '2026-02-05 14:00:00' order by updated_at desc; # 7th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where id = 649; # 670 - Eventeny , portalId: 4492849
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-18 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 670 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; #
SELECT * FROM crm_configurations where id = 48; # 51 - CleanCloud , portalId: 4373137
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-03-04 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 51 and updated_at > '2026-02-09 08:00:00' order by updated_at desc;
select * from users where team_id = 51; # 7783
SELECT * FROM groups WHERE uuid_to_bin('8a8d2cb6-8b55-4fa3-8b5c-5f0e3d8de59a') = uuid; # 1130
select * from activity_searches where user_id = 7783;
select * from activity_search_filters where activity_search_id IN (32291, 32292);
SELECT asf.activity_search_id, asf.id, asf.value
FROM activity_search_filters asf
WHERE asf.filter = 'group_id'
AND asf.value IN (
SELECT CONCAT(
HEX(SUBSTR(uuid, 5, 4)), '-',
HEX(SUBSTR(uuid, 3, 2)), '-',
HEX(SUBSTR(uuid, 1, 2)), '-',
HEX(SUBSTR(uuid, 9, 2)), '-',
HEX(SUBSTR(uuid, 11))
)
FROM groups
WHERE deleted_at IS NOT NULL
);
SELECT * FROM crm_configurations where id = 272; # 290 - Bonham & Brook , portalId: 5705856
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-05 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 290 and updated_at > '2026-02-09 08:00:00' order by updated_at desc; # 6th
# [PASSWORD_DOTS]
SELECT * FROM crm_configurations where provider = 'hubspot';
SELECT * FROM crm_configurations where id = 1056; # 1119 - Chromatic , portalId: 45602133
SELECT * FROM opportunities WHERE team_id = 1119 and remotely_created_at > '2026-02-01 00:00:00' order by updated_at desc;
SELECT * FROM opportunities WHERE team_id = 1119 and updated_at > '2026-02-09 09:00:00' order by updated_at desc; # null
# [PASSWORD_DOTS]
select * from contacts where crm_provider_id = '003Uu00000ojD4NIAU';
select
cp.*
# DISTINCT t.id
# cp.id, cp.user_id, t.id, cp.crm_configuration_id, cp.contact_fields
FROM crm_profiles cp
JOIN crm_configurations crm on crm.id = cp.crm_configuration_id
JOIN users u on u.id = cp.user_id
JOIN teams t ON t.id = crm.team_id
WHERE crm.provider = 'salesforce' and t.status = 'active'
and cp.archived_at IS NULL and u.deleted_at IS NULL
and t.id NOT IN (1093)
and t.id = 2
and cp.contact_fields IS NULL;
# and c.crm_provider_id = '003Uu00000ojD4NIAU';
SELECT * FROM users WHERE id = 26484;
SELECT * FROM crm_profiles WHERE user_id = 26484;
SELECT * FROM social_accounts WHERE sociable_id = 26484;
SELECT * FROM crm_configurations where provider = 'salesforce';
select * from users where id IN (10022, 10403);
select * from users where team_id IN (526);
select * from teams where id IN (526, 532);
select * from crm_configurations where id IN (500, 516);
select * from crm_profiles where crm_configuration_id IN (500, 516) and user_id IN (10022, 10403);
select * from contacts where crm_configuration_id IN (500, 516) and crm_provider_id = '003Uu00000ojD4NIAU';
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 526 and sa.provider = 'salesforce';
select * from team_settings where team_id IN (526, 532);
select * from users where id IN (22824);
select * from crm_profiles where crm_configuration_id IN (1026);
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1093 and sa.provider = 'salesforce';
select * from teams where id = 1099;
select * from users where id = 29643
select * from activity_processing_states;
SELECT * FROM teams where name LIKE '%Fare%'; # 233
SELECT * FROM opportunities where crm_configuration_id = 215
# and crm_provider_id = 'oppo_ogESZf2P50nDrd1nGPvKDXeA6sSaTN5v51Lp4ayVzKR'
;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1088 and sa.provider = 'hubspot';
SELECT * FROM teams order by updated_at DESC
SELECT * FROM crm_configurations WHERE id = 1019; # SimpleConsign 1088 - no social account
select * from crm_configurations where provider = 'pipedrive';
select * from teams where id = 957;
select * from crm_configurations where id = 957;
SELECT * FROM teams WHERE name LIKE '%Prolific%'; # 544, 518, 10743
SELECT * FROM opportunities where crm_configuration_id = 518 order by id desc;
select * from users where team_id = 1; # 26726 - Gabriela Dureva
SELECT * FROM opportunities where user_id = 26726; # 16834447 - Prolific
select * from activities where user_id = 26726 order by id desc;
select * from contacts where crm_configuration_id = 1
and email IN ('[EMAIL]', '[EMAIL]'); # 2094416, 2093620
SELECT * FROM contacts WHERE id = 6284931;
SELECT p.* FROM activities a JOIN participants p ON a.id = p.activity_id
WHERE a.user_id = 26726 and p.lead_id IN (2094416, 2093620) and a.created_at > '2026-01-01 00:00:00' order by p.email;
select * from activities where id IN (75509259,75509261,75509261,75511034,75026464,75517602,75517605);
select * from crm_configurations where id = 1;
43801692-1aeb-32ce-acba-5b80a479701a
44c3c9cf-6f5e-75f3-8179-bc9f75dd2b1b
405975c0-b3d0-7aaa-821f-09d59cae6dd1
4caf848d-4bed-2299-b248-7788d41f9fca
49bedc3f-f196-eef3-89c3-dea6a3b4aa63
43420989-a09d-b8f8-9806-c8bbf7a02aac
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
SELECT * FROM activities WHERE id = 75461988;
SELECT * FROM activities WHERE uuid_to_bin('d6c5052e-e972-49e9-8912-26f2f7d6c5f6') = uuid;
select * from contacts where id = 17900517;
select * from contact_roles cr join crm_configurations crm on cr.crm_configuration_id = crm.id
where crm.provider != 'salesforce';
select * from users where id = 21047;
SELECT * FROM crm_configurations WHERE id = 892;
SELECT * FROM teams WHERE id = 942;
select * from opportunities where team_id = 942 order by updated_at desc;
select * from contacts where team_id = 942 order by updated_at desc;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 942 and sa.provider = 'hubspot';
SELECT * FROM opportunities where team_id = 1 and crm_provider_id IN ('006Pq00000NeH6XIAV', '006Pq000007z8kdIAA'); # 10697889, 6621430
SELECT * FROM crm_configurations WHERE id = 1;
SELECT * FROM teams WHERE crm_id = 1;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1 and sa.provider = 'salesforce';
select id, user_id, opportunity_fields from crm_profiles where crm_configuration_id = 1
SELECT * FROM opportunities where team_id = 1 order by updated_at desc; # 10697889, 6621430
select * from teams where id = 852;
select * from groups where id = 2286;
select * from sidekick_settings where team_id = 852;
select * from default_activity_types where team_id = 852;
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id AND p.id IS NULL -- no profile
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active' -- team is active
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1 AND u.deleted_at IS NULL
AND u.crm_required = 1
AND u.team_id = 1
ORDER BY u.team_id;
SELECT * FROM crm_profiles cp where cp.crm_configuration_id = 1 and cp.user_id IN (
18481
);
SELECT cc.provider, cc.id, p.id, u.*
FROM users u
LEFT JOIN crm_profiles p ON u.id = p.user_id
INNER JOIN teams t ON u.team_id = t.id AND t.status = 'active'
INNER JOIN crm_configurations cc ON t.crm_id = cc.id
WHERE u.status = 1
AND u.deleted_at IS NULL
AND u.crm_required = 1
# AND u.team_id = 1
AND p.id IS NULL -- Move this condition to WHERE clause
ORDER BY u.team_id;
SELECT * FROM opportunities WHERE id = 20002609;
select * from teams where id = 1122; # Velatir, 29953 - [EMAIL]
select * from crm_configurations where id = 1060;
select * from crm_layouts where crm_configuration_id = 1060;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3596;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1122 and sa.provider = 'hubspot';
select * from opportunities where team_id = 1122 order by updated_at desc;
select * from crm_field_data where object_type = 'contact';
SELECT * FROM activities WHERE uuid_to_bin('374fc8ed-3315-4c9f-9b25-318b7fd2928f') = uuid; # 76584262
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 248 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles where user_id = 24115; # 005QF000002CswMYAS
SELECT * FROM users where id = 24115;
SELECT * FROM accounts where id = 4002896;
SELECT * FROM teams WHERE name LIKE '%adswerve%';
SELECT * FROM opportunities where crm_configuration_id = 230 AND crm_provider_id IN ("0069N000003GIQ9QAO","0061r000019yGP9AAM","0066900001S2KWlAAN","0066900001TDpj2AAD","0066900001b8uEwAAI","0069N000001rQi0QAE","006QF00000KD40mYAD","006QF00000LzpRJYAZ","0069N000002uomtQAA","0069N000002xlMLQAY","0066900001NV6ubAAD","0061r00001HJp45AAD","006QF00000uTlUoYAK","006QF00000v0bZqYAI");
SELECT * FROM opportunities WHERE crm_configuration_id = 230 AND crm_provider_id = '0069N000003GIQ9QAO'; # 6272203
SELECT u.id, u.email, ac.name, a.* FROM activities a
JOIN users u ON a.user_id = u.id
JOIN accounts ac ON a.account_id = ac.id
WHERE
uuid_to_bin('e3269598-b562-44fb-b5e9-9d2694dc63e0') = a.uuid or
uuid_to_bin('66ddc3ab-4e15-45aa-af0c-248c1eece593') = a.uuid or
uuid_to_bin('826bd328-e1cc-4213-b8d8-572454cacc07') = a.uuid;
select * from users where id = 5825;
SELECT * FROM activities WHERE uuid_to_bin('e56aa2e8-231a-421b-ab1f-cb38ed2bf573') = uuid;
select * from activities where uuid_to_bin('91e13b2f-2d1b-45f8-b1fd-1141b6563782') = uuid;
19594, 862
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 862 and sa.provider = 'salesforce';
select * from automated_reports where id = 36;
select ar.frequency, r.*, ar.* from automated_report_results r
join automated_reports ar on r.report_id = ar.id
where ar.frequency != 'one_off';
select s.* from activity_searches s join users u ON s.user_id = u.id where u.team_id = 882;
select * from nudges n where n.activity_search_id
select * from teams where created_at > '2026-03-09';
SELECT * FROM crm_layouts WHERE crm_configuration_id = 1065; # 1065
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 3617;
select * from users where team_id = 1 and name like '%Lukas%'; # 7160
SELECT * FROM teams WHERE id = 575;
select * from opportunities where team_id = 575;
SELECT * FROM teams WHERE name LIKE '%Integrum ESG%'; # 1126, 1065,
select * from opportunities where team_id = 1126;
SELECT * FROM teams WHERE name LIKE '%Base%'; # 1125, 1063,
select * from opportunities where team_id = 1125;
select * from contacts c
where c.team_id = 882;
SELECT * FROM activities WHERE id = 76822967;
SELECT * FROM crm_profiles WHERE user_id = 15440;
SELECT * FROM crm_profiles WHERE crm_configuration_id = 555;
SELECT * FROM crm_configurations WHERE id = 555;
SELECT * FROM users WHERE id = 15440; # team. 581, gr. 15440, pl. 3911, act. field 162182
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 581 and sa.provider = 'salesforce';
SELECT * FROM automated_report_results order by id desc;
select * from features;
select * from team_features where feature_id = 40;
select * from teams where id = 556;
select * from automated_reports;
where id = 54; # 4fdd41f6-dcf0-30d0-b339-7345381b6044 , ["pdf","podcast"]
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from automated_report_results order by id desc;
SELECT * FROM automated_report_results WHERE id = 1919;
select * from automated_report_results WHERE report_id = 54;
select * from opportunities where id = 7594349;
SELECT * FROM teams WHERE name LIKE '%Les%'; # 711, 692, 16067 - [EMAIL]
select * from playbooks where team_id = 711; # event 226147
SELECT * FROM playbook_categories WHERE playbook_id = 5515;
SELECT * FROM crm_fields WHERE crm_configuration_id = 692 and object_type = 'event';
SELECT * FROM crm_fields WHERE id = 226147;
SELECT * FROM crm_field_values WHERE crm_field_id = 226147;
SELECT * FROM crm_configurations WHERE id = 692;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 711 and sa.provider = 'salesforce';
SELECT * FROM crm_profiles cp JOIN users u on u.id = cp.user_id WHERE u.team_id = 711;
select * from leads;
select * from calendars;
SELECT
t.id AS team_id,
t.name,
LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1)) AS calendar_domain
FROM teams t
JOIN users u ON u.team_id = t.id
JOIN calendars c ON c.user_id = u.id AND c.status = 'active' AND c.calendar_provider_id LIKE '%@%'
LEFT JOIN team_domains td
ON td.team_id = t.id
AND td.deleted_at IS NULL
AND td.domain = LOWER(SUBSTRING_INDEX(c.calendar_provider_id, '@', -1))
GROUP BY t.id, t.name, calendar_domain
ORDER BY t.name, calendar_domain;
select * from users u join calendars c on c.user_id = u.id
where u.team_id = 882;
select * from activities where id = 74049485; # team 563 crm 537
select * from activities where id = 73272382; # team 563 crm 537
select * from activities where id = 64400389; # team 563 crm 537
select * from activities where id = 58081273; # team 563 crm 537
select * from activities where id = 54520297; # team 563 crm 537
select * from participants where activity_id = 58081273;
select * from activities where crm_configuration_id = 537 and provider = 'aircall'
and account_id = 19003658 order by updated_at desc;
select * from contacts where crm_configuration_id = 537 and id = 35957759;
select * from accounts where crm_configuration_id = 537 and id = 19003658;
select * from automated_report_results where id = 1976;
select * from automated_reports where id = 583;
select * from activity_searches where id = 87714;
select * from activity_search_filters where activity_search_id = 87714;
SELECT * FROM activities WHERE uuid_to_bin('8827f672-202d-4162-9d04-73ff5f0566a9') = uuid
or uuid_to_bin('47842446-af51-4bcb-854f-cc6560290101') = uuid;
SELECT * FROM crm_configurations WHERE provider = 'hubspot';
select * from rate_limits;
select * from automated_report_results where media_type = 'pdf' and status = 2
and id IN (18, 1872);
select * from automated_reports where id = 54;
SELECT * FROM users WHERE id IN (24623,29443,29613);
SELECT * FROM automated_report_results WHERE uuid_to_bin('822fa41b-afd3-43a9-a248-86b0e36f3131') = uuid;
select * from text_relays where created_at > '2026-05-01'
and id IN (32415, 32416);
# and id = 32412;
select * from users where team_id = 2 and email like '%scott%' and id = 29510;
SELECT * FROM activities WHERE uuid_to_bin('67cebfc2-ed56-44a2-8c68-7a0286ed8618') = uuid; # 79763436
SELECT email_provider_id, COUNT(*) as count, GROUP_CONCAT(id) as ids, GROUP_CONCAT(status) as statuses
FROM text_relays
WHERE email_provider_id IN ('19e2027868a64b42', '19e2033ed8ea6b10')
GROUP BY email_provider_id;
SELECT id, status, telephony_provider_id, created_at
FROM activities
WHERE id IN (80028719, 80028846);
SELECT id, status, code, email_sent_at, created_at, updated_at
FROM text_relays
WHERE id IN (32415, 32416);
SELECT id, status, code, sender, recipient, created_at
FROM text_relays
WHERE sender LIKE '%mario.georgiev%' OR sender LIKE '%stoyan.tomov%'
ORDER BY created_at DESC
LIMIT 10;
SELECT id, uuid, status, code, sender, recipient, created_at, updated_at
FROM text_relays
WHERE uuid = uuid_to_bin('0626141c-27a6-4d8c-aff8-7c8020a2c656');
# [PASSWORD_DOTS]
SELECT DISTINCT u.id, u.email, u.name, u.softphone_number, COUNT(a.id) as sms_count
FROM users u
INNER JOIN activities a ON u.id = a.user_id
WHERE a.type LIKE 'sms%'
# AND a.created_at > DATE_SUB(NOW(), INTERVAL 30 DAY)
GROUP BY u.id, u.email, u.name, u.softphone_number
ORDER BY sms_count DESC;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
49090
|
NULL
|
NULL
|
NULL
|
|
77798
|
NULL
|
0
|
2026-05-27T11:17:15.941277+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-27/1779 /Users/lukas/.screenpipe/data/data/2026-05-27/1779880635941_m1.jpg...
|
Firefox
|
CloudWatch | us-east-2 — Work
|
1
|
us-east-2.console.aws.amazon.com/cloudwatch/home?r us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-1800~timeType~'RELATIVE~tz~'UTC~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40message*2c*20*40logStream*2c*20*40log*0a*7c*20filter*20*40message*20like*20*22TextRelayService*22*20*0a*7c*20filter*20*40message*20not*20like*20*2fAnalytic*2f*20*7c*20filter*20*40message*20not*20like*20*2fTranscript*2f*0a*7c*20filter*20*40message*20not*20like*20*2fWebhook*2f*20*7c*20filter*20*40message*20not*20like*20*2fMeetingBot*2f*20*0a*7c*20limit*2010000~queryId~'0551e814-f51a-4339-8372-80d7ba4cef27~source~(~'*2a)~lang~'CWLI~logClass~'STANDARD~accountIDs~(~'All)~queryBy~'allLogGroups)...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 5 Q2 - Platform Team - Scrum Board Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
[JY-20915] Add environment-specific email domains for text relay to prevent duplicate processing - Jira
Pipelines - jiminny/app
Pipelines - jiminny/app
Unnamed Group
[JY-19958] Upgrade BE libraries - May - Jira
[JY-19958] Upgrade BE libraries - May - Jira
jiminny/app/backend-code - Vanta
jiminny/app/backend-code - Vanta
NVD - cve-2026-6104
NVD - cve-2026-6104
NVD - cve-2026-6722
NVD - cve-2026-6722
NVD - cve-2026-7261
NVD - cve-2026-7261
NVD - cve-2025-14179
NVD - cve-2025-14179
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
Text relay
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
CloudWatch | us-east-2
CloudWatch | us-east-2
Close tab
JY-20915 fix strict casting by LakyLak · Pull Request #12134 · jiminny/app
JY-20915 fix strict casting by LakyLak · Pull Request #12134 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
Lukas Kovalik - Time Off
Lukas Kovalik - Time Off
Jiminny
Jiminny
Audi Motors | Account | Salesforce
Audi Motors | Account | Salesforce
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
Inbox (1,728) - [EMAIL] - Jiminny Mail
Inbox (1,728) - [EMAIL] - Jiminny Mail
New Tab
Customize sidebar
Close Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
AI Chat settings
Close
Main menu
Open mode picker, currently 3.1 Pro
Gemini
3.1 Pro
New Chat
Open menu for conversation actions.
Conversation with Gemini
Conversation with Gemini
You said I’m on page “<tabTitle>NVD - cve-2025-14179</tabTitle>” with “<selection>Description In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements. Metrics NVD enrichment efforts reference publicly available information to associate vector strings. CVSS information contributed by other sources is also displayed. CVSS 3.x Severity and Vector Strings: NIST: NVD Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References to Advisories, Solutions, and Tools By selecting these links, you will be leaving NIST webspace. We have provided these links to other web sites because they may have information that would be of interest to you. No inferences should be drawn on account of other sites being referenced, or not, from this page. There may be other web sites that are more appropriate for your purpose. NIST does not necessarily endorse the views expressed, or concur with the facts presented on these sites. Further, NIST does not endorse any commercial products that may be mentioned on these sites. Please address comments about this page to [EMAIL]. URL Source(s) Tag(s) https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm PHP Group Vendor Advisory Weakness Enumeration CWE-ID CWE Name Source CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') PHP Group Known Affected Software Configurations Switch to CPE 2.2 Configuration 1 ( hide ) cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.2.0Up to (excluding)8.2.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.3.0Up to (excluding)8.3.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.4.0Up to (excluding)8.4.21 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.5.0Up to (excluding)8.5.6 Denotes Vulnerable Software Are we missing a CPE here? Please let us know. Change History 2 change records found show changes</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
You said
I’m on page “<tabTitle>NVD - cve-2025-14179</tabTitle>” with “<selection>Description
In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements.
Metrics
NVD enrichment efforts reference publicly available information to associate
vector strings. CVSS information contributed by other sources is also
displayed.
CVSS 3.x Severity and Vector Strings:
NIST: NVD
Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving NIST webspace.
We have provided these links to other web sites because they
may have information that would be of interest to you. No
inferences should be drawn on account of other sites being
referenced, or not, from this page. There may be other web
sites that are more appropriate for your purpose. NIST does
not necessarily endorse the views expressed, or concur with
the facts presented on these sites. Further, NIST does not
endorse any commercial products that may be mentioned on
these sites. Please address comments about this page to [EMAIL].
URL
Source(s)
Tag(s)
https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm
PHP Group
Vendor Advisory
Weakness Enumeration
CWE-ID
CWE Name
Source
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
PHP Group
Known Affected Software Configurations Switch
to CPE 2.2
Configuration 1 ( hide ) cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.2.0Up to (excluding)8.2.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.3.0Up to (excluding)8.3.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.4.0Up to (excluding)8.4.21 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.5.0Up to (excluding)8.5.6
Denotes Vulnerable Software
Are we missing a CPE here? Please let us know.
Change History
2 change records found show changes</selection>” selected.
Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
Expand
Copy prompt
Gemini said
Gemini said
Vulnerability Summary
Vulnerability Summary
CVE Identifier:
CVE-2025-14179
Vulnerability Type:
CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Component:
PHP PDO Firebird driver
Technical Description
Technical Description
The PDO Firebird driver improperly handles
NUL
bytes during token-by-token SQL query construction. When copying a string token containing a
NUL
byte, the driver utilizes
strncat()
, which terminates prematurely at the
NUL
byte. This drops the closing quote of the string, causing subsequent SQL tokens to be interpreted as part of the string literal. Consequently, an attacker can achieve SQL injection if user-controlled values are processed via
PDO::quote()
and embedded into SQL statements.
Severity and Impact
Severity and Impact
CVSS 3.1 Score / Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Impact Profile:
High impact across Confidentiality, Integrity, and Availability (
C:H/I:H/A:H
). It requires low attack complexity (
AC:L
), no privileges (
PR:N
), and no user interaction (
UI:N
).
Affected Software Configurations
Affected Software Configurations
The vulnerability affects the following PHP versions:
PHP 8.2.*:
From 8.2.0 up to (excluding) 8.2.31
PHP 8.3.*:
From 8.3.0 up to (excluding) 8.3.31
PHP 8.4.*:
From 8.4.0 up to (excluding) 8.4.21
PHP 8.5.*:
From 8.5.0 up to (excluding) 8.5.6
References & Advisory Links
References & Advisory Links
Vendor Advisory:
GitHub Security Advisory (GHSA-w476-322c-wpvm)
GitHub Security Advisory (GHSA-w476-322c-wpvm)
provided by the PHP Group.
Good response
Bad response
Share & export
Copy
Show more options
You said how to fix
You said
how to fix
Copy prompt
Edit
Gemini said
Gemini said...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"[JY-20915] Add environment-specific email domains for text relay to prevent duplicate processing - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Unnamed Group","depth":4,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"[JY-19958] Upgrade BE libraries - May - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-19958] Upgrade BE libraries - May - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"jiminny/app/backend-code - Vanta","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny/app/backend-code - Vanta","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-6104","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-6104","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-6722","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-6722","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2026-7261","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2026-7261","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"NVD - cve-2025-14179","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NVD - cve-2025-14179","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20613] Allow owner's role to be selected when setting up a trial - Jira","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20613] Allow owner's role to be selected when setting up a trial - Jira","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Text relay","depth":4,"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"TypeError: Jiminny\\Services\\Mail\\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: Jiminny\\Services\\Mail\\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"CloudWatch | us-east-2","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"CloudWatch | us-east-2","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"JY-20915 fix strict casting by LakyLak · Pull Request #12134 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20915 fix strict casting by LakyLak · Pull Request #12134 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Lukas Kovalik - Time Off","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Lukas Kovalik - Time Off","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Audi Motors | Account | Salesforce","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Audi Motors | Account | Salesforce","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"TypeError: Jiminny\\Services\\Mail\\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"TypeError: Jiminny\\Services\\Mail\\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Inbox (1,728) - lukas.kovalik@jiminny.com - Jiminny Mail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Inbox (1,728) - lukas.kovalik@jiminny.com - Jiminny Mail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close Google Gemini (⌃X)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"AI Chat settings","depth":3,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":3,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Main menu","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open mode picker, currently 3.1 Pro","depth":6,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Gemini","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.1 Pro","depth":11,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Chat","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open menu for conversation actions.","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Conversation with Gemini","depth":7,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation with Gemini","depth":8,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"You said I’m on page “<tabTitle>NVD - cve-2025-14179</tabTitle>” with “<selection>Description In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements. Metrics NVD enrichment efforts reference publicly available information to associate vector strings. CVSS information contributed by other sources is also displayed. CVSS 3.x Severity and Vector Strings: NIST: NVD Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References to Advisories, Solutions, and Tools By selecting these links, you will be leaving NIST webspace. We have provided these links to other web sites because they may have information that would be of interest to you. No inferences should be drawn on account of other sites being referenced, or not, from this page. There may be other web sites that are more appropriate for your purpose. NIST does not necessarily endorse the views expressed, or concur with the facts presented on these sites. Further, NIST does not endorse any commercial products that may be mentioned on these sites. Please address comments about this page to nvd@nist.gov. URL Source(s) Tag(s) https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm PHP Group Vendor Advisory Weakness Enumeration CWE-ID CWE Name Source CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') PHP Group Known Affected Software Configurations Switch to CPE 2.2 Configuration 1 ( hide ) cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.2.0Up to (excluding)8.2.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.3.0Up to (excluding)8.3.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.4.0Up to (excluding)8.4.21 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.5.0Up to (excluding)8.5.6 Denotes Vulnerable Software Are we missing a CPE here? Please let us know. Change History 2 change records found show changes</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","depth":13,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"I’m on page “<tabTitle>NVD - cve-2025-14179</tabTitle>” with “<selection>Description","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements.","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Metrics","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NVD enrichment efforts reference publicly available information to associate","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"vector strings. CVSS information contributed by other sources is also","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"displayed.","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CVSS 3.x Severity and Vector Strings:","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NIST: NVD","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Vector:","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"References to Advisories, Solutions, and Tools","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By selecting these links, you will be leaving NIST webspace.","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"We have provided these links to other web sites because they","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"may have information that would be of interest to you. No","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"inferences should be drawn on account of other sites being","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"referenced, or not, from this page. There may be other web","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sites that are more appropriate for your purpose. NIST does","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"not necessarily endorse the views expressed, or concur with","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the facts presented on these sites. Further, NIST does not","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"endorse any commercial products that may be mentioned on","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"these sites. Please address comments about this page to nvd@nist.gov.","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Source(s)","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Tag(s)","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP Group","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Vendor Advisory","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weakness Enumeration","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CWE-ID","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CWE Name","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Source","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CWE-89","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP Group","depth":15,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Known Affected Software Configurations Switch","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to CPE 2.2","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Configuration 1 ( hide ) cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From (including)8.2.0Up to (excluding)8.2.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From (including)8.3.0Up to (excluding)8.3.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From (including)8.4.0Up to (excluding)8.4.21 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From (including)8.5.0Up to (excluding)8.5.6","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Denotes Vulnerable Software","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Are we missing a CPE here? Please let us know.","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Change History","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 change records found show changes</selection>” selected.","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Expand","depth":13,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy prompt","depth":12,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Gemini said","depth":12,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gemini said","depth":13,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Vulnerability Summary","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Vulnerability Summary","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CVE Identifier:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CVE-2025-14179","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Vulnerability Type:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Component:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP PDO Firebird driver","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Technical Description","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Technical Description","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The PDO Firebird driver improperly handles","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NUL","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bytes during token-by-token SQL query construction. When copying a string token containing a","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NUL","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"byte, the driver utilizes","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"strncat()","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", which terminates prematurely at the","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NUL","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"byte. This drops the closing quote of the string, causing subsequent SQL tokens to be interpreted as part of the string literal. Consequently, an attacker can achieve SQL injection if user-controlled values are processed via","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PDO::quote()","depth":17,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"and embedded into SQL statements.","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Severity and Impact","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Severity and Impact","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CVSS 3.1 Score / Vector:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Impact Profile:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"High impact across Confidentiality, Integrity, and Availability (","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"C:H/I:H/A:H","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"). It requires low attack complexity (","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AC:L","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"), no privileges (","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PR:N","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"), and no user interaction (","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"UI:N","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":").","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Affected Software Configurations","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Affected Software Configurations","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"The vulnerability affects the following PHP versions:","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP 8.2.*:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From 8.2.0 up to (excluding) 8.2.31","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP 8.3.*:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From 8.3.0 up to (excluding) 8.3.31","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP 8.4.*:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From 8.4.0 up to (excluding) 8.4.21","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"PHP 8.5.*:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"From 8.5.0 up to (excluding) 8.5.6","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"References & Advisory Links","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"References & Advisory Links","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Vendor Advisory:","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"GitHub Security Advisory (GHSA-w476-322c-wpvm)","depth":18,"on_screen":false,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"GitHub Security Advisory (GHSA-w476-322c-wpvm)","depth":19,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"provided by the PHP Group.","depth":18,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXCheckBox","text":"Good response","depth":15,"on_screen":false,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bad response","depth":15,"on_screen":false,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Share & export","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":15,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show more options","depth":14,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"You said how to fix","depth":13,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"how to fix","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy prompt","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Edit","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"Gemini said","depth":12,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gemini said","depth":13,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9080129111607459997
|
-6105193821344810354
|
click
|
accessibility
|
NULL
|
Platform Sprint 5 Q2 - Platform Team - Scrum Board Platform Sprint 5 Q2 - Platform Team - Scrum Board - Jira
[JY-20915] Add environment-specific email domains for text relay to prevent duplicate processing - Jira
Pipelines - jiminny/app
Pipelines - jiminny/app
Unnamed Group
[JY-19958] Upgrade BE libraries - May - Jira
[JY-19958] Upgrade BE libraries - May - Jira
jiminny/app/backend-code - Vanta
jiminny/app/backend-code - Vanta
NVD - cve-2026-6104
NVD - cve-2026-6104
NVD - cve-2026-6722
NVD - cve-2026-6722
NVD - cve-2026-7261
NVD - cve-2026-7261
NVD - cve-2025-14179
NVD - cve-2025-14179
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
High vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Medium vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
Low vulnerabilities identified in packages are addressed (GitHub Repo) - Vanta
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
[JY-20613] Allow owner's role to be selected when setting up a trial - Jira
Text relay
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
CloudWatch | us-east-2
CloudWatch | us-east-2
Close tab
JY-20915 fix strict casting by LakyLak · Pull Request #12134 · jiminny/app
JY-20915 fix strict casting by LakyLak · Pull Request #12134 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
JY-20963 fix deleted object import by LakyLak · Pull Request #12121 · jiminny/app
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {"status":"error","message":"You have reached your secondly limit.","errorType":"RATE_LIMIT
Lukas Kovalik - Time Off
Lukas Kovalik - Time Off
Jiminny
Jiminny
Audi Motors | Account | Salesforce
Audi Motors | Account | Salesforce
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
TypeError: Jiminny\Services\Mail\TextRelayService::setHistoryPoint(): Argument #2 ($historyPoint) must be of type int, string given, called in /home/jiminny/app/Services/Mail/TextRelayService.php on line 118 — jiminny — app
Inbox (1,728) - [EMAIL] - Jiminny Mail
Inbox (1,728) - [EMAIL] - Jiminny Mail
New Tab
Customize sidebar
Close Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
AI Chat settings
Close
Main menu
Open mode picker, currently 3.1 Pro
Gemini
3.1 Pro
New Chat
Open menu for conversation actions.
Conversation with Gemini
Conversation with Gemini
You said I’m on page “<tabTitle>NVD - cve-2025-14179</tabTitle>” with “<selection>Description In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements. Metrics NVD enrichment efforts reference publicly available information to associate vector strings. CVSS information contributed by other sources is also displayed. CVSS 3.x Severity and Vector Strings: NIST: NVD Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References to Advisories, Solutions, and Tools By selecting these links, you will be leaving NIST webspace. We have provided these links to other web sites because they may have information that would be of interest to you. No inferences should be drawn on account of other sites being referenced, or not, from this page. There may be other web sites that are more appropriate for your purpose. NIST does not necessarily endorse the views expressed, or concur with the facts presented on these sites. Further, NIST does not endorse any commercial products that may be mentioned on these sites. Please address comments about this page to [EMAIL]. URL Source(s) Tag(s) https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm PHP Group Vendor Advisory Weakness Enumeration CWE-ID CWE Name Source CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') PHP Group Known Affected Software Configurations Switch to CPE 2.2 Configuration 1 ( hide ) cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.2.0Up to (excluding)8.2.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.3.0Up to (excluding)8.3.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.4.0Up to (excluding)8.4.21 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s) From (including)8.5.0Up to (excluding)8.5.6 Denotes Vulnerable Software Are we missing a CPE here? Please let us know. Change History 2 change records found show changes</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
You said
I’m on page “<tabTitle>NVD - cve-2025-14179</tabTitle>” with “<selection>Description
In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements.
Metrics
NVD enrichment efforts reference publicly available information to associate
vector strings. CVSS information contributed by other sources is also
displayed.
CVSS 3.x Severity and Vector Strings:
NIST: NVD
Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving NIST webspace.
We have provided these links to other web sites because they
may have information that would be of interest to you. No
inferences should be drawn on account of other sites being
referenced, or not, from this page. There may be other web
sites that are more appropriate for your purpose. NIST does
not necessarily endorse the views expressed, or concur with
the facts presented on these sites. Further, NIST does not
endorse any commercial products that may be mentioned on
these sites. Please address comments about this page to [EMAIL].
URL
Source(s)
Tag(s)
https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm
PHP Group
Vendor Advisory
Weakness Enumeration
CWE-ID
CWE Name
Source
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
PHP Group
Known Affected Software Configurations Switch
to CPE 2.2
Configuration 1 ( hide ) cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.2.0Up to (excluding)8.2.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.3.0Up to (excluding)8.3.31 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.4.0Up to (excluding)8.4.21 cpe:2.3:a:php:php:*:*:*:*:*:*:*:* Show Matching CPE(s)
From (including)8.5.0Up to (excluding)8.5.6
Denotes Vulnerable Software
Are we missing a CPE here? Please let us know.
Change History
2 change records found show changes</selection>” selected.
Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
Expand
Copy prompt
Gemini said
Gemini said
Vulnerability Summary
Vulnerability Summary
CVE Identifier:
CVE-2025-14179
Vulnerability Type:
CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Component:
PHP PDO Firebird driver
Technical Description
Technical Description
The PDO Firebird driver improperly handles
NUL
bytes during token-by-token SQL query construction. When copying a string token containing a
NUL
byte, the driver utilizes
strncat()
, which terminates prematurely at the
NUL
byte. This drops the closing quote of the string, causing subsequent SQL tokens to be interpreted as part of the string literal. Consequently, an attacker can achieve SQL injection if user-controlled values are processed via
PDO::quote()
and embedded into SQL statements.
Severity and Impact
Severity and Impact
CVSS 3.1 Score / Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Impact Profile:
High impact across Confidentiality, Integrity, and Availability (
C:H/I:H/A:H
). It requires low attack complexity (
AC:L
), no privileges (
PR:N
), and no user interaction (
UI:N
).
Affected Software Configurations
Affected Software Configurations
The vulnerability affects the following PHP versions:
PHP 8.2.*:
From 8.2.0 up to (excluding) 8.2.31
PHP 8.3.*:
From 8.3.0 up to (excluding) 8.3.31
PHP 8.4.*:
From 8.4.0 up to (excluding) 8.4.21
PHP 8.5.*:
From 8.5.0 up to (excluding) 8.5.6
References & Advisory Links
References & Advisory Links
Vendor Advisory:
GitHub Security Advisory (GHSA-w476-322c-wpvm)
GitHub Security Advisory (GHSA-w476-322c-wpvm)
provided by the PHP Group.
Good response
Bad response
Share & export
Copy
Show more options
You said how to fix
You said
how to fix
Copy prompt
Edit
Gemini said
Gemini said...
|
77796
|
NULL
|
NULL
|
NULL
|
|
9418
|
426
|
7
|
2026-05-08T12:49:03.765845+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778244543765_m2.jpg...
|
Firefox
|
Jy 20820 es reindex stream model hydration by Vasi Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app — Work...
|
1
|
github.com/jiminny/app/pull/12059/changes#diff-f77 github.com/jiminny/app/pull/12059/changes#diff-f77c5793308caa3e764a033422493121a1329dd953a89f3dde4a9386622f22f9...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Unnamed Group
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS] -5,69 +5,64 @@5namespace Jiminny\Component\ES\Processor\Actions;5namespace Jiminny\Component\ES\Processor\Actions;667use Elastica\Document;7use Elastica\Document;8-use Illuminate\Support\Collection;9use Jiminny\Component\ElasticSearch\Contract\Searchable;8use Jiminny\Component\ElasticSearch\Contract\Searchable;10use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;9use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;11use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;10use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;12use Jiminny\Component\ES\Processor\EntityQueryBuilder;11use Jiminny\Component\ES\Processor\EntityQueryBuilder;13-use Jiminny\Component\ES\Processor\Traits\SkipActivityTrait;14use Jiminny\Exceptions\SyncActivityException;12use Jiminny\Exceptions\SyncActivityException;15use Jiminny\Models\Model;13use Jiminny\Models\Model;16use Sentry\Laravel\Facade as Sentry;14use Sentry\Laravel\Facade as Sentry;15+use Throwable;171618class LoadDocumentsAction17class LoadDocumentsAction19{18{20-use SkipActivityTrait;19+public function __construct(21-20+private readonly EntityQueryBuilder $queryBuilder22-private const int RDS_CHUNK_SIZE = 250;21+ ) {22+ }232324-/**25- * @codeCoverageIgnore26- */27public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad24public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad28 {25 {29$documentsToUpdate = new SimpleCollection();26$documentsToUpdate = new SimpleCollection();30$documentsToDelete = new SimpleCollection();27$documentsToDelete = new SimpleCollection();312832-// do get mariadb data29+$query = $this->queryBuilder->getEntityQuery($updateTarget, $entityIdsList);33-$query = EntityQueryBuilder::getEntityQuery($updateTarget, $entityIdsList);343035-$query->chunkByIdDesc(31+/** @var Model&Searchable $entityModel */36-self::RDS_CHUNK_SIZE,32+foreach ($query->cursor() as $entityModel) {37-function (Collection $entityModels) use ($documentsToUpdate, $documentsToDelete) {33+if ($entityModel->isDeleted()) {38-/** @var Model&Searchable $entityForDeletion */34+/**39-foreach ($entityModels->whereNotNull('deleted_at') as $entityForDeletion) {35+ * Cleanup (from ElasticSearch) scheduled entities that were recently deleted.40-$documentsToDelete->add($entityForDeletion->getId());36+ * After a deletion, no more updates on a record are expected, so the operation is considered final,41- }37+ * unless the record is restored.42-38+ */43-/** @var Model&Searchable $entityModel */39+$documentsToDelete->add($entityModel->getId());44-foreach ($entityModels->whereNull('deleted_at') as $entityModel) {40+ } else {45-if (self::shouldSkipActivity($entityModel)) {41+try {46-/**42+$documentsToUpdate->add(47- * If the activity type is in the skip list, we should not push it for indexing.43+new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())48- * If an ES record already exists, we should remove it to free up storage and processing power44+ );49- */45+ } catch (Throwable $error) {50-$documentsToDelete->add($entityModel->getId());46+ Sentry::captureException(51-47+new SyncActivityException(52-continue;48+'ES entity async RDS build data failed',53- }49+$error->getCode(),54-50+$error55-try {51+ )56-$documentsToUpdate->add(52+ );57-new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())58- );59- } catch (\Throwable $error) {60- Sentry::captureException(61-new SyncActivityException(62-'ES entity async RDS build data failed',63-$error->getCode(),64-$error65- )66- );67- }68 }53 }69 }54 }70- );55+56+/**57+ * Clean up fragmented memory.58+ * Dropping relations and unsetting the entity model after hydration and usage,59+ * allows GC to remove heap memory allocations, and recycle already allocated memory,60+ * instead of allocating more memory from OS.61+ * Unset operations signal GC to collect destroyed object memory62+ */63+$entityModel->setRelations([]);64+ unset($entityModel);65+ }716672return new DocumentLoad($documentsToUpdate, $documentsToDelete);67return new DocumentLoad($documentsToUpdate, $documentsToDelete);73 }68 }</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
You said
I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -5,69 +5,64 @@5namespace Jiminny\Component\ES\Processor\Actions;5namespace Jiminny\Component\ES\Processor\Actions;667use Elastica\Document;7use Elastica\Document;8-use Illuminate\Support\Collection;9use Jiminny\Component\ElasticSearch\Contract\Searchable;8use Jiminny\Component\ElasticSearch\Contract\Searchable;10use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;9use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;11use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;10use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;12use Jiminny\Component\ES\Processor\EntityQueryBuilder;11use Jiminny\Component\ES\Processor\EntityQueryBuilder;13-use Jiminny\Component\ES\Processor\Traits\SkipActivityTrait;14use Jiminny\Exceptions\SyncActivityException;12use Jiminny\Exceptions\SyncActivityException;15use Jiminny\Models\Model;13use Jiminny\Models\Model;16use Sentry\Laravel\Facade as Sentry;14use Sentry\Laravel\Facade as Sentry;15+use Throwable;171618class LoadDocumentsAction17class LoadDocumentsAction19{18{20-use SkipActivityTrait;19+public function __construct(21-20+private readonly EntityQueryBuilder $queryBuilder22-private const int RDS_CHUNK_SIZE = 250;21+ ) {22+ }232324-/**25- * @codeCoverageIgnore26- */27public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad24public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad28 {25 {29$documentsToUpdate = new SimpleCollection();26$documentsToUpdate = new SimpleCollection();30$documentsToDelete = new SimpleCollection();27$documentsToDelete = new SimpleCollection();312832-// do get mariadb data29+$query = $this->queryBuilder->getEntityQuery($updateTarget, $entityIdsList);33-$query = EntityQueryBuilder::getEntityQuery($updateTarget, $entityIdsList);343035-$query->chunkByIdDesc(31+/** @var Model&Searchable $entityModel */36-self::RDS_CHUNK_SIZE,32+foreach ($query->cursor() as $entityModel) {37-function (Collection $entityModels) use ($documentsToUpdate, $documentsToDelete) {33+if ($entityModel->isDeleted()) {38-/** @var Model&Searchable $entityForDeletion */34+/**39-foreach ($entityModels->whereNotNull('deleted_at') as $entityForDeletion) {35+ * Cleanup (from ElasticSearch) scheduled entities that were recently deleted.40-$documentsToDelete->add($entityForDeletion->getId());36+ * After a deletion, no more updates on a record are expected, so the operation is considered final,41- }37+ * unless the record is restored.42-38+ */43-/** @var Model&Searchable $entityModel */39+$documentsToDelete->add($entityModel->getId());44-foreach ($entityModels->whereNull('deleted_at') as $entityModel) {40+ } else {45-if (self::shouldSkipActivity($entityModel)) {41+try {46-/**42+$documentsToUpdate->add(47- * If the activity type is in the skip list, we should not push it for indexing.43+new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())48- * If an ES record already exists, we should remove it to free up storage and processing power44+ );49- */45+ } catch (Throwable $error) {50-$documentsToDelete->add($entityModel->getId());46+ Sentry::captureException(51-47+new SyncActivityException(52-continue;48+'ES entity async RDS build data failed',53- }49+$error->getCode(),54-50+$error55-try {51+ )56-$documentsToUpdate->add(52+ );57-new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())58- );59- } catch (\Throwable $error) {60- Sentry::captureException(61-new SyncActivityException(62-'ES entity async RDS build data failed',63-$error->getCode(),64-$error65- )66- );67- }68 }53 }69 }54 }70- );55+56+/**57+ * Clean up fragmented memory.58+ * Dropping relations and unsetting the entity model after hydration and usage,59+ * allows GC to remove heap memory allocations, and recycle already allocated memory,60+ * instead of allocating more memory from OS.61+ * Unset operations signal GC to collect destroyed object memory62+ */63+$entityModel->setRelations([]);64+ unset($entityModel);65+ }716672return new DocumentLoad($documentsToUpdate, $documentsToDelete);67return new DocumentLoad($documentsToUpdate, $documentsToDelete);73 }68 }</selection>” selected.
Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
Collapse
Listen
Show more options
Show thinking
Gemini said
Gemini said
Overview
Overview
This diff refactors the
LoadDocumentsAction
class to optimize memory usage and data processing. It transitions the database query execution from batch chunking to lazy loading using cursors, introduces explicit memory management techniques, and updates the class structure to use dependency injection.
Architectural & Structural Changes
Architectural & Structural Changes
Dependency Injection:
Injected
EntityQueryBuilder
via the constructor instead of calling it statically.
Removed Traits & Constants:
Removed the
SkipActivityTrait
entirely (and its associated skip logic), as well as the
RDS_CHUNK_SIZE
constant.
Namespace Imports:
Added the
Throwable
import and removed
Illuminate\Support\Collection
.
Data Processing Refactor
Data Processing Refactor
Cursor Implementation:
Replaced
chunkByIdDesc
with
cursor()
, iterating through records sequentially rather than loading batches of 250 into memory.
Simplified Deletion Checks:
Replaced Laravel collection filtering (
whereNotNull('deleted_at')
) with a direct
$entityModel->isDeleted()
check on each model during iteration....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.2237367,"top":0.0518755,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira","depth":5,"bounds":{"left":0.23703457,"top":0.06304868,"width":0.10106383,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Unnamed Group","depth":4,"bounds":{"left":0.2265625,"top":0.08978452,"width":0.007978723,"height":0.01915403},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"bounds":{"left":0.2265625,"top":0.11332801,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"bounds":{"left":0.23969415,"top":0.1245012,"width":0.4644282,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":4,"bounds":{"left":0.2265625,"top":0.14604948,"width":0.07679521,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"SevenShores\\Hubspot\\Exceptions\\BadRequest: Client error: `POST https://api.hubapi.com/crm/v3/objects/contact/search` resulted in a `429 Too Many Requests` response: {\"status\":\"error\",\"message\":\"You have reached your secondly limit.\",\"errorType\":\"RATE_LIMIT","depth":5,"bounds":{"left":0.23969415,"top":0.15722266,"width":0.4644282,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":4,"bounds":{"left":0.2237367,"top":0.17877094,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Service-Desk - Queues - Platform team - Service space - Jira","depth":5,"bounds":{"left":0.23703457,"top":0.18994413,"width":0.10721409,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app","depth":4,"bounds":{"left":0.2237367,"top":0.21149242,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20807 check various issues with stages by nikolaybiaivanov · Pull Request #12041 · jiminny/app","depth":5,"bounds":{"left":0.23703457,"top":0.22266561,"width":0.17037898,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.2237367,"top":0.2442139,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.23703457,"top":0.25538707,"width":0.042719416,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20818 move ask jiminny reports to its own datadog metric by LakyLak · Pull Request #12056 · jiminny/app","depth":4,"bounds":{"left":0.2237367,"top":0.27693537,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20818 move ask jiminny reports to its own datadog metric by LakyLak · Pull Request #12056 · jiminny/app","depth":5,"bounds":{"left":0.23703457,"top":0.28810853,"width":0.18899602,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Userpilot | Ask Jiminny Report Generated","depth":4,"bounds":{"left":0.2237367,"top":0.30965683,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Userpilot | Ask Jiminny Report Generated","depth":5,"bounds":{"left":0.23703457,"top":0.32083002,"width":0.07164229,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":4,"bounds":{"left":0.2237367,"top":0.3423783,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-20773 fix user pilot tracking ofr automated report generated by LakyLak · Pull Request #12024 · jiminny/app","depth":5,"bounds":{"left":0.23703457,"top":0.35355148,"width":0.19331782,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Problem loading page","depth":4,"bounds":{"left":0.2237367,"top":0.37509975,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Problem loading page","depth":5,"bounds":{"left":0.23703457,"top":0.38627294,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search the CRM - HubSpot docs","depth":4,"bounds":{"left":0.2237367,"top":0.40782124,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search the CRM - HubSpot docs","depth":5,"bounds":{"left":0.23703457,"top":0.41899443,"width":0.05651596,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.2237367,"top":0.4405427,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.23703457,"top":0.4517159,"width":0.013131649,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.2237367,"top":0.47326416,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.23703457,"top":0.48443735,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.2237367,"top":0.5059856,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.23703457,"top":0.5171588,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"AI Features | Datadog","depth":4,"bounds":{"left":0.2237367,"top":0.5387071,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"AI Features | Datadog","depth":5,"bounds":{"left":0.23703457,"top":0.54988027,"width":0.037400264,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20493 smart instant nudge pre filtering by nikolaybiaivanov · Pull Request #12053 · jiminny/app","depth":4,"bounds":{"left":0.2237367,"top":0.5714286,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jy 20493 smart instant nudge pre filtering by nikolaybiaivanov · Pull Request #12053 · jiminny/app","depth":5,"bounds":{"left":0.23703457,"top":0.5826017,"width":0.17037898,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.2237367,"top":0.60415006,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.23703457,"top":0.61532325,"width":0.039228722,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":4,"bounds":{"left":0.2237367,"top":0.6368715,"width":0.07962101,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jy 20820 es reindex stream model hydration by Vasil-Jiminny · Pull Request #12059 · jiminny/app","depth":5,"bounds":{"left":0.23703457,"top":0.6480447,"width":0.16888298,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.29105717,"top":0.6440543,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.2265625,"top":0.6711891,"width":0.07413564,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.2265625,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Close Google Gemini (⌃X)","depth":6,"bounds":{"left":0.23753324,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.2486702,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.25980717,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.27094415,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"AI Chat settings","depth":7,"bounds":{"left":0.4084109,"top":0.055067837,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":7,"bounds":{"left":0.42037898,"top":0.055067837,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"WORK, Google Account: lukas.kovalik@jiminny.com","depth":12,"bounds":{"left":0.41771942,"top":0.103751,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Main menu","depth":12,"bounds":{"left":0.3073471,"top":0.103751,"width":0.013297873,"height":0.031923383},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Chat","depth":12,"bounds":{"left":0.38979387,"top":0.103751,"width":0.013297873,"height":0.031923383},"on_screen":true,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open menu for conversation actions.","depth":12,"bounds":{"left":0.40309176,"top":0.103751,"width":0.013297873,"height":0.031923383},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Conversation with Gemini","depth":15,"bounds":{"left":0.30302528,"top":0.14764565,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Conversation with Gemini","depth":16,"bounds":{"left":0.30302528,"top":0.15003991,"width":0.1200133,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Copy prompt","depth":21,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXHeading","text":"You said I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -5,69 +5,64 @@5namespace Jiminny\\Component\\ES\\Processor\\Actions;5namespace Jiminny\\Component\\ES\\Processor\\Actions;667use Elastica\\Document;7use Elastica\\Document;8-use Illuminate\\Support\\Collection;9use Jiminny\\Component\\ElasticSearch\\Contract\\Searchable;8use Jiminny\\Component\\ElasticSearch\\Contract\\Searchable;10use Jiminny\\Component\\ES\\Processor\\DTOs\\DocumentLoad;9use Jiminny\\Component\\ES\\Processor\\DTOs\\DocumentLoad;11use Jiminny\\Component\\ES\\Processor\\DTOs\\SimpleCollection;10use Jiminny\\Component\\ES\\Processor\\DTOs\\SimpleCollection;12use Jiminny\\Component\\ES\\Processor\\EntityQueryBuilder;11use Jiminny\\Component\\ES\\Processor\\EntityQueryBuilder;13-use Jiminny\\Component\\ES\\Processor\\Traits\\SkipActivityTrait;14use Jiminny\\Exceptions\\SyncActivityException;12use Jiminny\\Exceptions\\SyncActivityException;15use Jiminny\\Models\\Model;13use Jiminny\\Models\\Model;16use Sentry\\Laravel\\Facade as Sentry;14use Sentry\\Laravel\\Facade as Sentry;15+use Throwable;171618class LoadDocumentsAction17class LoadDocumentsAction19{18{20-use SkipActivityTrait;19+public function __construct(21-20+private readonly EntityQueryBuilder $queryBuilder22-private const int RDS_CHUNK_SIZE = 250;21+ ) {22+ }232324-/**25- * @codeCoverageIgnore26- */27public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad24public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad28 {25 {29$documentsToUpdate = new SimpleCollection();26$documentsToUpdate = new SimpleCollection();30$documentsToDelete = new SimpleCollection();27$documentsToDelete = new SimpleCollection();312832-// do get mariadb data29+$query = $this->queryBuilder->getEntityQuery($updateTarget, $entityIdsList);33-$query = EntityQueryBuilder::getEntityQuery($updateTarget, $entityIdsList);343035-$query->chunkByIdDesc(31+/** @var Model&Searchable $entityModel */36-self::RDS_CHUNK_SIZE,32+foreach ($query->cursor() as $entityModel) {37-function (Collection $entityModels) use ($documentsToUpdate, $documentsToDelete) {33+if ($entityModel->isDeleted()) {38-/** @var Model&Searchable $entityForDeletion */34+/**39-foreach ($entityModels->whereNotNull('deleted_at') as $entityForDeletion) {35+ * Cleanup (from ElasticSearch) scheduled entities that were recently deleted.40-$documentsToDelete->add($entityForDeletion->getId());36+ * After a deletion, no more updates on a record are expected, so the operation is considered final,41- }37+ * unless the record is restored.42-38+ */43-/** @var Model&Searchable $entityModel */39+$documentsToDelete->add($entityModel->getId());44-foreach ($entityModels->whereNull('deleted_at') as $entityModel) {40+ } else {45-if (self::shouldSkipActivity($entityModel)) {41+try {46-/**42+$documentsToUpdate->add(47- * If the activity type is in the skip list, we should not push it for indexing.43+new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())48- * If an ES record already exists, we should remove it to free up storage and processing power44+ );49- */45+ } catch (Throwable $error) {50-$documentsToDelete->add($entityModel->getId());46+ Sentry::captureException(51-47+new SyncActivityException(52-continue;48+'ES entity async RDS build data failed',53- }49+$error->getCode(),54-50+$error55-try {51+ )56-$documentsToUpdate->add(52+ );57-new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())58- );59- } catch (\\Throwable $error) {60- Sentry::captureException(61-new SyncActivityException(62-'ES entity async RDS build data failed',63-$error->getCode(),64-$error65- )66- );67- }68 }53 }69 }54 }70- );55+56+/**57+ * Clean up fragmented memory.58+ * Dropping relations and unsetting the entity model after hydration and usage,59+ * allows GC to remove heap memory allocations, and recycle already allocated memory,60+ * instead of allocating more memory from OS.61+ * Unset operations signal GC to collect destroyed object memory62+ */63+$entityModel->setRelations([]);64+ unset($entityModel);65+ }716672return new DocumentLoad($documentsToUpdate, $documentsToDelete);67return new DocumentLoad($documentsToUpdate, $documentsToDelete);73 }68 }</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You said","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -5,69 +5,64 @@5namespace Jiminny\\Component\\ES\\Processor\\Actions;5namespace Jiminny\\Component\\ES\\Processor\\Actions;667use Elastica\\Document;7use Elastica\\Document;8-use Illuminate\\Support\\Collection;9use Jiminny\\Component\\ElasticSearch\\Contract\\Searchable;8use Jiminny\\Component\\ElasticSearch\\Contract\\Searchable;10use Jiminny\\Component\\ES\\Processor\\DTOs\\DocumentLoad;9use Jiminny\\Component\\ES\\Processor\\DTOs\\DocumentLoad;11use Jiminny\\Component\\ES\\Processor\\DTOs\\SimpleCollection;10use Jiminny\\Component\\ES\\Processor\\DTOs\\SimpleCollection;12use Jiminny\\Component\\ES\\Processor\\EntityQueryBuilder;11use Jiminny\\Component\\ES\\Processor\\EntityQueryBuilder;13-use Jiminny\\Component\\ES\\Processor\\Traits\\SkipActivityTrait;14use Jiminny\\Exceptions\\SyncActivityException;12use Jiminny\\Exceptions\\SyncActivityException;15use Jiminny\\Models\\Model;13use Jiminny\\Models\\Model;16use Sentry\\Laravel\\Facade as Sentry;14use Sentry\\Laravel\\Facade as Sentry;15+use Throwable;171618class LoadDocumentsAction17class LoadDocumentsAction19{18{20-use SkipActivityTrait;19+public function __construct(21-20+private readonly EntityQueryBuilder $queryBuilder22-private const int RDS_CHUNK_SIZE = 250;21+ ) {22+ }232324-/**25- * @codeCoverageIgnore26- */27public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad24public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad28 {25 {29$documentsToUpdate = new SimpleCollection();26$documentsToUpdate = new SimpleCollection();30$documentsToDelete = new SimpleCollection();27$documentsToDelete = new SimpleCollection();312832-// do get mariadb data29+$query = $this->queryBuilder->getEntityQuery($updateTarget, $entityIdsList);33-$query = EntityQueryBuilder::getEntityQuery($updateTarget, $entityIdsList);343035-$query->chunkByIdDesc(31+/** @var Model&Searchable $entityModel */36-self::RDS_CHUNK_SIZE,32+foreach ($query->cursor() as $entityModel) {37-function (Collection $entityModels) use ($documentsToUpdate, $documentsToDelete) {33+if ($entityModel->isDeleted()) {38-/** @var Model&Searchable $entityForDeletion */34+/**39-foreach ($entityModels->whereNotNull('deleted_at') as $entityForDeletion) {35+ * Cleanup (from ElasticSearch) scheduled entities that were recently deleted.40-$documentsToDelete->add($entityForDeletion->getId());36+ * After a deletion, no more updates on a record are expected, so the operation is considered final,41- }37+ * unless the record is restored.42-38+ */43-/** @var Model&Searchable $entityModel */39+$documentsToDelete->add($entityModel->getId());44-foreach ($entityModels->whereNull('deleted_at') as $entityModel) {40+ } else {45-if (self::shouldSkipActivity($entityModel)) {41+try {46-/**42+$documentsToUpdate->add(47- * If the activity type is in the skip list, we should not push it for indexing.43+new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())48- * If an ES record already exists, we should remove it to free up storage and processing power44+ );49- */45+ } catch (Throwable $error) {50-$documentsToDelete->add($entityModel->getId());46+ Sentry::captureException(51-47+new SyncActivityException(52-continue;48+'ES entity async RDS build data failed',53- }49+$error->getCode(),54-50+$error55-try {51+ )56-$documentsToUpdate->add(52+ );57-new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())58- );59- } catch (\\Throwable $error) {60- Sentry::captureException(61-new SyncActivityException(62-'ES entity async RDS build data failed',63-$error->getCode(),64-$error65- )66- );67- }68 }53 }69 }54 }70- );55+56+/**57+ * Clean up fragmented memory.58+ * Dropping relations and unsetting the entity model after hydration and usage,59+ * allows GC to remove heap memory allocations, and recycle already allocated memory,60+ * instead of allocating more memory from OS.61+ * Unset operations signal GC to collect destroyed object memory62+ */63+$entityModel->setRelations([]);64+ unset($entityModel);65+ }716672return new DocumentLoad($documentsToUpdate, $documentsToDelete);67return new DocumentLoad($documentsToUpdate, $documentsToDelete);73 }68 }</selection>” selected.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":21,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Listen","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Show more options","depth":20,"on_screen":false,"role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Show thinking","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Gemini said","depth":20,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Gemini said","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Overview","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Overview","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This diff refactors the","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"LoadDocumentsAction","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"class to optimize memory usage and data processing. It transitions the database query execution from batch chunking to lazy loading using cursors, introduces explicit memory management techniques, and updates the class structure to use dependency injection.","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Architectural & Structural Changes","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Architectural & Structural Changes","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Dependency Injection:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Injected","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"EntityQueryBuilder","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"via the constructor instead of calling it statically.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Removed Traits & Constants:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Removed the","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SkipActivityTrait","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"entirely (and its associated skip logic), as well as the","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RDS_CHUNK_SIZE","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"constant.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Namespace Imports:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Added the","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Throwable","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import and removed","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Illuminate\\Support\\Collection","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Data Processing Refactor","depth":23,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Data Processing Refactor","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Cursor Implementation:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Replaced","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"chunkByIdDesc","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", iterating through records sequentially rather than loading batches of 250 into memory.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Simplified Deletion Checks:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Replaced Laravel collection filtering (","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"whereNotNull('deleted_at')","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") with a direct","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"$entityModel->isDeleted()","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"check on each model during iteration.","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9079878467323511640
|
-1205540250475351643
|
click
|
accessibility
|
NULL
|
Platform Sprint 3 Q2 - Platform Team - Scrum Board Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Platform Sprint 3 Q2 - Platform Team - Scrum Board - Jira
Unnamed Group
SevenShores\Hubspot\Exceptions\BadRequest: Client error: `POST [URL_WITH_CREDENTIALS] -5,69 +5,64 @@5namespace Jiminny\Component\ES\Processor\Actions;5namespace Jiminny\Component\ES\Processor\Actions;667use Elastica\Document;7use Elastica\Document;8-use Illuminate\Support\Collection;9use Jiminny\Component\ElasticSearch\Contract\Searchable;8use Jiminny\Component\ElasticSearch\Contract\Searchable;10use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;9use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;11use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;10use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;12use Jiminny\Component\ES\Processor\EntityQueryBuilder;11use Jiminny\Component\ES\Processor\EntityQueryBuilder;13-use Jiminny\Component\ES\Processor\Traits\SkipActivityTrait;14use Jiminny\Exceptions\SyncActivityException;12use Jiminny\Exceptions\SyncActivityException;15use Jiminny\Models\Model;13use Jiminny\Models\Model;16use Sentry\Laravel\Facade as Sentry;14use Sentry\Laravel\Facade as Sentry;15+use Throwable;171618class LoadDocumentsAction17class LoadDocumentsAction19{18{20-use SkipActivityTrait;19+public function __construct(21-20+private readonly EntityQueryBuilder $queryBuilder22-private const int RDS_CHUNK_SIZE = 250;21+ ) {22+ }232324-/**25- * @codeCoverageIgnore26- */27public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad24public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad28 {25 {29$documentsToUpdate = new SimpleCollection();26$documentsToUpdate = new SimpleCollection();30$documentsToDelete = new SimpleCollection();27$documentsToDelete = new SimpleCollection();312832-// do get mariadb data29+$query = $this->queryBuilder->getEntityQuery($updateTarget, $entityIdsList);33-$query = EntityQueryBuilder::getEntityQuery($updateTarget, $entityIdsList);343035-$query->chunkByIdDesc(31+/** @var Model&Searchable $entityModel */36-self::RDS_CHUNK_SIZE,32+foreach ($query->cursor() as $entityModel) {37-function (Collection $entityModels) use ($documentsToUpdate, $documentsToDelete) {33+if ($entityModel->isDeleted()) {38-/** @var Model&Searchable $entityForDeletion */34+/**39-foreach ($entityModels->whereNotNull('deleted_at') as $entityForDeletion) {35+ * Cleanup (from ElasticSearch) scheduled entities that were recently deleted.40-$documentsToDelete->add($entityForDeletion->getId());36+ * After a deletion, no more updates on a record are expected, so the operation is considered final,41- }37+ * unless the record is restored.42-38+ */43-/** @var Model&Searchable $entityModel */39+$documentsToDelete->add($entityModel->getId());44-foreach ($entityModels->whereNull('deleted_at') as $entityModel) {40+ } else {45-if (self::shouldSkipActivity($entityModel)) {41+try {46-/**42+$documentsToUpdate->add(47- * If the activity type is in the skip list, we should not push it for indexing.43+new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())48- * If an ES record already exists, we should remove it to free up storage and processing power44+ );49- */45+ } catch (Throwable $error) {50-$documentsToDelete->add($entityModel->getId());46+ Sentry::captureException(51-47+new SyncActivityException(52-continue;48+'ES entity async RDS build data failed',53- }49+$error->getCode(),54-50+$error55-try {51+ )56-$documentsToUpdate->add(52+ );57-new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())58- );59- } catch (\Throwable $error) {60- Sentry::captureException(61-new SyncActivityException(62-'ES entity async RDS build data failed',63-$error->getCode(),64-$error65- )66- );67- }68 }53 }69 }54 }70- );55+56+/**57+ * Clean up fragmented memory.58+ * Dropping relations and unsetting the entity model after hydration and usage,59+ * allows GC to remove heap memory allocations, and recycle already allocated memory,60+ * instead of allocating more memory from OS.61+ * Unset operations signal GC to collect destroyed object memory62+ */63+$entityModel->setRelations([]);64+ unset($entityModel);65+ }716672return new DocumentLoad($documentsToUpdate, $documentsToDelete);67return new DocumentLoad($documentsToUpdate, $documentsToDelete);73 }68 }</selection>” selected. Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
You said
I’m on page “<tabTitle>Jy 20820 es reindex stream model hydration by Vasi</tabTitle>” with “<selection>@@ -5,69 +5,64 @@5namespace Jiminny\Component\ES\Processor\Actions;5namespace Jiminny\Component\ES\Processor\Actions;667use Elastica\Document;7use Elastica\Document;8-use Illuminate\Support\Collection;9use Jiminny\Component\ElasticSearch\Contract\Searchable;8use Jiminny\Component\ElasticSearch\Contract\Searchable;10use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;9use Jiminny\Component\ES\Processor\DTOs\DocumentLoad;11use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;10use Jiminny\Component\ES\Processor\DTOs\SimpleCollection;12use Jiminny\Component\ES\Processor\EntityQueryBuilder;11use Jiminny\Component\ES\Processor\EntityQueryBuilder;13-use Jiminny\Component\ES\Processor\Traits\SkipActivityTrait;14use Jiminny\Exceptions\SyncActivityException;12use Jiminny\Exceptions\SyncActivityException;15use Jiminny\Models\Model;13use Jiminny\Models\Model;16use Sentry\Laravel\Facade as Sentry;14use Sentry\Laravel\Facade as Sentry;15+use Throwable;171618class LoadDocumentsAction17class LoadDocumentsAction19{18{20-use SkipActivityTrait;19+public function __construct(21-20+private readonly EntityQueryBuilder $queryBuilder22-private const int RDS_CHUNK_SIZE = 250;21+ ) {22+ }232324-/**25- * @codeCoverageIgnore26- */27public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad24public function loadDocuments(string $updateTarget, array $entityIdsList): DocumentLoad28 {25 {29$documentsToUpdate = new SimpleCollection();26$documentsToUpdate = new SimpleCollection();30$documentsToDelete = new SimpleCollection();27$documentsToDelete = new SimpleCollection();312832-// do get mariadb data29+$query = $this->queryBuilder->getEntityQuery($updateTarget, $entityIdsList);33-$query = EntityQueryBuilder::getEntityQuery($updateTarget, $entityIdsList);343035-$query->chunkByIdDesc(31+/** @var Model&Searchable $entityModel */36-self::RDS_CHUNK_SIZE,32+foreach ($query->cursor() as $entityModel) {37-function (Collection $entityModels) use ($documentsToUpdate, $documentsToDelete) {33+if ($entityModel->isDeleted()) {38-/** @var Model&Searchable $entityForDeletion */34+/**39-foreach ($entityModels->whereNotNull('deleted_at') as $entityForDeletion) {35+ * Cleanup (from ElasticSearch) scheduled entities that were recently deleted.40-$documentsToDelete->add($entityForDeletion->getId());36+ * After a deletion, no more updates on a record are expected, so the operation is considered final,41- }37+ * unless the record is restored.42-38+ */43-/** @var Model&Searchable $entityModel */39+$documentsToDelete->add($entityModel->getId());44-foreach ($entityModels->whereNull('deleted_at') as $entityModel) {40+ } else {45-if (self::shouldSkipActivity($entityModel)) {41+try {46-/**42+$documentsToUpdate->add(47- * If the activity type is in the skip list, we should not push it for indexing.43+new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())48- * If an ES record already exists, we should remove it to free up storage and processing power44+ );49- */45+ } catch (Throwable $error) {50-$documentsToDelete->add($entityModel->getId());46+ Sentry::captureException(51-47+new SyncActivityException(52-continue;48+'ES entity async RDS build data failed',53- }49+$error->getCode(),54-50+$error55-try {51+ )56-$documentsToUpdate->add(52+ );57-new Document((string) $entityModel->getId(), $entityModel->getIndexableAttributes())58- );59- } catch (\Throwable $error) {60- Sentry::captureException(61-new SyncActivityException(62-'ES entity async RDS build data failed',63-$error->getCode(),64-$error65- )66- );67- }68 }53 }69 }54 }70- );55+56+/**57+ * Clean up fragmented memory.58+ * Dropping relations and unsetting the entity model after hydration and usage,59+ * allows GC to remove heap memory allocations, and recycle already allocated memory,60+ * instead of allocating more memory from OS.61+ * Unset operations signal GC to collect destroyed object memory62+ */63+$entityModel->setRelations([]);64+ unset($entityModel);65+ }716672return new DocumentLoad($documentsToUpdate, $documentsToDelete);67return new DocumentLoad($documentsToUpdate, $documentsToDelete);73 }68 }</selection>” selected.
Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.
Collapse
Listen
Show more options
Show thinking
Gemini said
Gemini said
Overview
Overview
This diff refactors the
LoadDocumentsAction
class to optimize memory usage and data processing. It transitions the database query execution from batch chunking to lazy loading using cursors, introduces explicit memory management techniques, and updates the class structure to use dependency injection.
Architectural & Structural Changes
Architectural & Structural Changes
Dependency Injection:
Injected
EntityQueryBuilder
via the constructor instead of calling it statically.
Removed Traits & Constants:
Removed the
SkipActivityTrait
entirely (and its associated skip logic), as well as the
RDS_CHUNK_SIZE
constant.
Namespace Imports:
Added the
Throwable
import and removed
Illuminate\Support\Collection
.
Data Processing Refactor
Data Processing Refactor
Cursor Implementation:
Replaced
chunkByIdDesc
with
cursor()
, iterating through records sequentially rather than loading batches of 250 into memory.
Simplified Deletion Checks:
Replaced Laravel collection filtering (
whereNotNull('deleted_at')
) with a direct
$entityModel->isDeleted()
check on each model during iteration....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
55228
|
1914
|
3
|
2026-05-18T13:58:09.790476+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779112689790_m1.jpg...
|
PhpStorm
|
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project Files
Preview
Filter
Open in Find Tool Win Project Files
Preview
Filter
Open in Find Tool Window
Ringcentral
RingCentral app/DTO/ImportCall/RingCentral
RingCentral app/Jobs/Activity/RingCentral
RingCentral app/Services/Activity/RingCentral
RingCentral app/Console/Commands/Activities/RingCentral
RingCentral tests/Unit/DTO/ImportCall/RingCentral
RingCentral tests/Unit/Jobs/Activity/RingCentral
RingCentral tests/Unit/Services/Activity/RingCentral
RingCentral build/coverage/DTO/ImportCall/RingCentral
RingCentral build/coverage/Jobs/Activity/RingCentral
RingCentral build/coverage/Services/Activity/RingCentral
RingCentral build/coverage/Console/Commands/Activities/RingCentral
RingCentralException.php .../app/Exceptions/RingCentralException.php, exception class...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project Files","depth":2,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Preview","depth":2,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter","depth":2,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Find Tool Window","depth":2,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Ringcentral","depth":1,"on_screen":true,"value":"Ringcentral","role_description":"text field","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"RingCentral app/DTO/ImportCall/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral app/Jobs/Activity/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral app/Services/Activity/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral app/Console/Commands/Activities/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral tests/Unit/DTO/ImportCall/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral tests/Unit/Jobs/Activity/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral tests/Unit/Services/Activity/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral build/coverage/DTO/ImportCall/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral build/coverage/Jobs/Activity/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral build/coverage/Services/Activity/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentral build/coverage/Console/Commands/Activities/RingCentral","depth":2,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"RingCentralException.php .../app/Exceptions/RingCentralException.php, exception class","depth":2,"on_screen":true,"role_description":"text"}]...
|
9079820741256413983
|
-4025493993621278703
|
visual_change
|
accessibility
|
NULL
|
Project Files
Preview
Filter
Open in Find Tool Win Project Files
Preview
Filter
Open in Find Tool Window
Ringcentral
RingCentral app/DTO/ImportCall/RingCentral
RingCentral app/Jobs/Activity/RingCentral
RingCentral app/Services/Activity/RingCentral
RingCentral app/Console/Commands/Activities/RingCentral
RingCentral tests/Unit/DTO/ImportCall/RingCentral
RingCentral tests/Unit/Jobs/Activity/RingCentral
RingCentral tests/Unit/Services/Activity/RingCentral
RingCentral build/coverage/DTO/ImportCall/RingCentral
RingCentral build/coverage/Jobs/Activity/RingCentral
RingCentral build/coverage/Services/Activity/RingCentral
RingCentral build/coverage/Console/Commands/Activities/RingCentral
RingCentralException.php .../app/Exceptions/RingCentralException.php, exception class...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
86308
|
2961
|
12
|
2026-05-28T14:01:42.568818+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-28/1779 /Users/lukas/.screenpipe/data/data/2026-05-28/1779976902568_m2.jpg...
|
PhpStorm
|
faVsco.js – Service.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
rapstomViewNeweNNCCodeKelucioWindowFV faVsco.|s ~# rapstomViewNeweNNCCodeKelucioWindowFV faVsco.|s ~#12121 on JY-20963-fx-inProinet vphp helpers.phpOHlourns RatchShal Paita UserRoleobserver.onaKerneloti)JiminnyDebugCommand.phg(©) Client.phd© JournalEventTransfornM Metadata> OpportunitySyncStratcaclass servace excenos baseservace aolesentsaPae naon1273PosoecoecstoeDa Redis12341235DSSAMCPGI1236 @>1391P—Wewnookc) Batchsvnceorector cho1382c) Batchsvncred sservice o1393© elent.phgC) •osed DealStagesservicel1385Deal fieldsservice ono1386 01343C) Decorate ctmim cho1344c) Fediivoeconverter.one@ Hubseo:Clientintertace.oh 1346lcttneodttokentinmoatoe pawiose ttioaeooo@ Pemote CrmObinctstanion, 1348d PaenonesNormalizn nhoc Service.php© SyncFieldAction.php© SyncRelatedActivityManac 1352e Mohhaol CunaRatchOron> @ IntegrationApoMlietonore>@ Metadata> c Migration> @ PipedrivewMGoloctmed1359> D Fields> Ba OpportunitvMatcher1241OOoORURWWIOC1RA3PENAMCARASC Decorate.ctimiy.onTbeletedc ectstietonoC FieldDefinitions.cho136613671368c Paviosd Bullider.onoc Pronle.ondcOuwyet de onocOuwylandier.ono1378137113721373c) Ouwviterator.nhoc) OueyRest teoho39741375Canneo nhr@ CwncRatchPodteConinon53770* Sinheritdoopublic function syncûpportunities(array Sparameters, ?string Sstrategy = null): int...;* Binhenitdodpublic function syncOpportunity(string Scraid): ?0pportunity...* ansows heconocroundexceoczororivare tuncicion inpor upporcunzy screbara: Ruoporcunz svSprofilo = Sthis->getOunerProfile( ownerid: Screbatal "Ounerid'] 22 null);accountnuaeif Cenntv(SconDataf«AccountId'1) aa= false) {aven Phccount Snccountaccaunt nrhisoscon dcsaccounrslowherelco"con orowider jd'. (stoina) Sernbatal"AccountId'1){4 (Saccount Fre nutt) fSaccount = Sthis->syncAccount(ScrnData["Accountid')):SuserId = Sprofile?->getUserId ?? Saccount?->getUserId@:if (SuserId === null)"id' => ScrnDataPId'hDDRreturn nult?ExtractSurround i=TSTage JSTCoe x/Sstage = nullalif Gisset(ScrnData('StageName'))) #Sstage = Sthis->confic•>stageseuhenenane", Scratara"StageNane"-Staop: - TYPF OppoRTuNTTy)=7е6CAMMAAAИННHI1ЗOBPRR752E7s3— 734II MI=custom.loglaravel.logSetm onwatoes noeslweleelrecoeoehoeORDER RY sns count nESKselect * fron teans where id = 1COlOAt& GAAn AAld0CGIEACONCAT(u.id, CASE WHEN u.id = t.ouner_id THEN ' (onner)' ELSE "* END) AS user_id,t.ounerid FROM social, accounts s.JOIN users u on u.id = sa.sociable.ioJOTN teans + 1.n<->1: on t.id = u.team_idTHERE u,tean Sid = 1117 and sauonowiden = "hubsoot*.SELECT * FROM activities WHERE uuid_to_bin('8024fffb-2df7-4017-91f4-d9f896050248') = uuid; # 79933459 YESSELECT * FROM activities WHERE uuid_to_bin('[CREDIT_CARD]-927f-4f4da2a818Sc') = uuid; # 80186192 NQMaEM FRiTeRnGWhEeE SOmWselect + fron users where id = 39249select * Eron nlavhonk cataaones nhere nilavbook 5d 5672)select + Eron er Geld vallues nhene crn Beld 3d = 450242)SFIEM & EROM eo Eeld data €aI0TM con frelde + 0M &ilooe Sreld 3d = €60IOTN sctustfae a nM Edl actáusty dd=aaoANO& AAR ARAUSARA Ae the dAfdudty QUANESELECT * FROM activity messagesselect * fron accounts where tean_id = 1 and name = 'Colunns"select * fron users where name Like "XSubrax*: = 31654, 1117select * fron teans where 1d = 1117select + fron activity searches nhere user 1a = 31854%select + fron activity search &iltens where activity seanch fa TN (RRRR). 8ROA2)# console fiaum045 A1 A41 У 66 4TO0У L7inu Lo wey tutServiceTesteeendhles orcesirwichhlesorca Deleion t+0.ao trougano peoes o don unestne wie to ao potoce Con lton Siep ly tiep be Pr M 5o ak.Let me walk you through this step-by-step with precise code references. First, let me show you the exact fiThesx RequiredYes, you need to add the carly Isdeleted check to both inportüpportunity() and importLead(). Here's exactiywherewurant imnortonnortunitv RPok-tctnaet7akhSprofile = Sthis->getOnerProfile(Scrabata("Omerid") 77 null); Il Line 1349nccoudr onewtwewtw/trrhathAccauattaohcesthicahsaccount = Sthis->config->accounts()-where(...)→first(): /1 Lines 1354-1356if (Saccount aamwaccounshesyncaccouncrcoonouhowneoyeoeereixed imoortOpportunityCORRECT- Add afline 13.48hinh.private function importüpportunity(ScraData): 20pportunity/7 Add this carly check (same pattern as incortAccount Line 1155)wotutscrbatal"Tcdeleted"h)Sthis-shandleEnt{tyDeletionByProviderId(Sthis->config=sopportunities(), ScreData):Sprofile = Sthis->getOnerProfile(ScrnData("Omerid") 77 null):11 ... rest of nethod unchanged ...Canlhwhlherahaaih nthondStep-by-Step Walkthrough: The "Race Condition"ineed to clantu: tis not a true race condition between thresois, out a saquence problem within a sinale requestAsk anything Xol" PodnAdhotvwMoctr lateeosltKchre dn "oe "atkelt4 spad...
|
NULL
|
9079551211011774316
|
NULL
|
click
|
ocr
|
NULL
|
rapstomViewNeweNNCCodeKelucioWindowFV faVsco.|s ~# rapstomViewNeweNNCCodeKelucioWindowFV faVsco.|s ~#12121 on JY-20963-fx-inProinet vphp helpers.phpOHlourns RatchShal Paita UserRoleobserver.onaKerneloti)JiminnyDebugCommand.phg(©) Client.phd© JournalEventTransfornM Metadata> OpportunitySyncStratcaclass servace excenos baseservace aolesentsaPae naon1273PosoecoecstoeDa Redis12341235DSSAMCPGI1236 @>1391P—Wewnookc) Batchsvnceorector cho1382c) Batchsvncred sservice o1393© elent.phgC) •osed DealStagesservicel1385Deal fieldsservice ono1386 01343C) Decorate ctmim cho1344c) Fediivoeconverter.one@ Hubseo:Clientintertace.oh 1346lcttneodttokentinmoatoe pawiose ttioaeooo@ Pemote CrmObinctstanion, 1348d PaenonesNormalizn nhoc Service.php© SyncFieldAction.php© SyncRelatedActivityManac 1352e Mohhaol CunaRatchOron> @ IntegrationApoMlietonore>@ Metadata> c Migration> @ PipedrivewMGoloctmed1359> D Fields> Ba OpportunitvMatcher1241OOoORURWWIOC1RA3PENAMCARASC Decorate.ctimiy.onTbeletedc ectstietonoC FieldDefinitions.cho136613671368c Paviosd Bullider.onoc Pronle.ondcOuwyet de onocOuwylandier.ono1378137113721373c) Ouwviterator.nhoc) OueyRest teoho39741375Canneo nhr@ CwncRatchPodteConinon53770* Sinheritdoopublic function syncûpportunities(array Sparameters, ?string Sstrategy = null): int...;* Binhenitdodpublic function syncOpportunity(string Scraid): ?0pportunity...* ansows heconocroundexceoczororivare tuncicion inpor upporcunzy screbara: Ruoporcunz svSprofilo = Sthis->getOunerProfile( ownerid: Screbatal "Ounerid'] 22 null);accountnuaeif Cenntv(SconDataf«AccountId'1) aa= false) {aven Phccount Snccountaccaunt nrhisoscon dcsaccounrslowherelco"con orowider jd'. (stoina) Sernbatal"AccountId'1){4 (Saccount Fre nutt) fSaccount = Sthis->syncAccount(ScrnData["Accountid')):SuserId = Sprofile?->getUserId ?? Saccount?->getUserId@:if (SuserId === null)"id' => ScrnDataPId'hDDRreturn nult?ExtractSurround i=TSTage JSTCoe x/Sstage = nullalif Gisset(ScrnData('StageName'))) #Sstage = Sthis->confic•>stageseuhenenane", Scratara"StageNane"-Staop: - TYPF OppoRTuNTTy)=7е6CAMMAAAИННHI1ЗOBPRR752E7s3— 734II MI=custom.loglaravel.logSetm onwatoes noeslweleelrecoeoehoeORDER RY sns count nESKselect * fron teans where id = 1COlOAt& GAAn AAld0CGIEACONCAT(u.id, CASE WHEN u.id = t.ouner_id THEN ' (onner)' ELSE "* END) AS user_id,t.ounerid FROM social, accounts s.JOIN users u on u.id = sa.sociable.ioJOTN teans + 1.n<->1: on t.id = u.team_idTHERE u,tean Sid = 1117 and sauonowiden = "hubsoot*.SELECT * FROM activities WHERE uuid_to_bin('8024fffb-2df7-4017-91f4-d9f896050248') = uuid; # 79933459 YESSELECT * FROM activities WHERE uuid_to_bin('[CREDIT_CARD]-927f-4f4da2a818Sc') = uuid; # 80186192 NQMaEM FRiTeRnGWhEeE SOmWselect + fron users where id = 39249select * Eron nlavhonk cataaones nhere nilavbook 5d 5672)select + Eron er Geld vallues nhene crn Beld 3d = 450242)SFIEM & EROM eo Eeld data €aI0TM con frelde + 0M &ilooe Sreld 3d = €60IOTN sctustfae a nM Edl actáusty dd=aaoANO& AAR ARAUSARA Ae the dAfdudty QUANESELECT * FROM activity messagesselect * fron accounts where tean_id = 1 and name = 'Colunns"select * fron users where name Like "XSubrax*: = 31654, 1117select * fron teans where 1d = 1117select + fron activity searches nhere user 1a = 31854%select + fron activity search &iltens where activity seanch fa TN (RRRR). 8ROA2)# console fiaum045 A1 A41 У 66 4TO0У L7inu Lo wey tutServiceTesteeendhles orcesirwichhlesorca Deleion t+0.ao trougano peoes o don unestne wie to ao potoce Con lton Siep ly tiep be Pr M 5o ak.Let me walk you through this step-by-step with precise code references. First, let me show you the exact fiThesx RequiredYes, you need to add the carly Isdeleted check to both inportüpportunity() and importLead(). Here's exactiywherewurant imnortonnortunitv RPok-tctnaet7akhSprofile = Sthis->getOnerProfile(Scrabata("Omerid") 77 null); Il Line 1349nccoudr onewtwewtw/trrhathAccauattaohcesthicahsaccount = Sthis->config->accounts()-where(...)→first(): /1 Lines 1354-1356if (Saccount aamwaccounshesyncaccouncrcoonouhowneoyeoeereixed imoortOpportunityCORRECT- Add afline 13.48hinh.private function importüpportunity(ScraData): 20pportunity/7 Add this carly check (same pattern as incortAccount Line 1155)wotutscrbatal"Tcdeleted"h)Sthis-shandleEnt{tyDeletionByProviderId(Sthis->config=sopportunities(), ScreData):Sprofile = Sthis->getOnerProfile(ScrnData("Omerid") 77 null):11 ... rest of nethod unchanged ...Canlhwhlherahaaih nthondStep-by-Step Walkthrough: The "Race Condition"ineed to clantu: tis not a true race condition between thresois, out a saquence problem within a sinale requestAsk anything Xol" PodnAdhotvwMoctr lateeosltKchre dn "oe "atkelt4 spad...
|
86306
|
NULL
|
NULL
|
NULL
|
|
9607
|
433
|
8
|
2026-05-08T13:10:17.890827+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778245817890_m1.jpg...
|
iTerm2
|
Claude
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Open sidebar
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
Code diff review
More options for Code diff review
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Screenpipe retention policy code location
More options for Screenpipe retention policy code location
Viewing retention policy in screenpipe
More options for Viewing retention policy in screenpipe
Clean shot x video recording termination issue
More options for Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
More options for HubSpot rate limit handling with executeRequest
Untitled
More options
💬 Screen pipe. Is there ability…
More options for 💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
More options for SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
More options for 💬 What is the best switch I can…
Permission denied on screenpipe volume
More options for Permission denied on screenpipe volume
Screenpipe sync database attachment error
More options for Screenpipe sync database attachment error
Last swimming outing with Dani
More options for Last swimming outing with Dani
Definition of incarcerated
More options for Definition of incarcerated
Chromecast remote volume buttons not working
More options for Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
More options for Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
More options for Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
More options for MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
More options for Security patch review and testing guidance
Food calorie values reference
More options for Food calorie values reference
Relaunch to update v1.6608.0
Relaunch to update
v1.6608.0
Lukas Pro
Get apps and extensions
Code diff review, rename chat
Code diff review
More options for Code diff review
Open sidebar
Share chat
Claude finished the response
You said: review the diff and give me your thoughts
You said: review the diff and give me your thoughts
1778244576295_CleanShot 2026-05-08 at [EMAIL]
review the diff and give me your thoughts
15:49
Retry
Edit
Copy
Claude responded: A few observations from the diff:
Claude responded: A few observations from the diff:
Scrutinized refactoring trade-offs and flagged behavioral concerns
Scrutinized refactoring trade-offs and flagged behavioral concerns
A few observations from the diff:
The big one —
shouldSkipActivity
is gone entirely.
The old code had logic that, for non-deleted entities, checked
self::shouldSkipActivity($entityModel)
and if true, added the entity to
$documentsToDelete
(to evict any stale ES record) and skipped indexing. The new code has no equivalent. If skip-list activity types still exist anywhere in the system, two regressions are possible: (1) they'll now get indexed when they shouldn't, and (2) any historical ES records for them won't be cleaned up. Worth confirming the skip logic moved upstream — maybe into the query builder or an observer — and isn't just dropped on the floor. If it really is intentionally removed, the PR description should call that out loudly because it's a behavioral change, not a refactor.
chunkByIdDesc(...)
→
cursor()
is a meaningful change, not a cosmetic one.
You lose the DESC ordering. If anything downstream assumed newest-first processing (priority for recent changes, deduplication where the latest write wins, etc.), that contract is now broken silently.
chunkByIdDesc
re-queries per chunk with a
WHERE id < lastId
cursor — it's resilient to the table being mutated during iteration, and each chunk releases its connection.
cursor()
holds a single unbuffered result set open for the entire iteration. On a large table, with Sentry calls and ES writes in the loop, that connection can stay open for a long time. Depending on MySQL/Postgres settings and the connection pool, that's worth a thought.
Memory-wise
cursor()
is technically lighter (one row at a time vs. RDS_CHUNK_SIZE rows), so if memory was the motivation, that tracks — but the trade-offs above should be weighed.
whereNotNull('deleted_at')
→
isDeleted()
— these are not necessarily equivalent.
isDeleted()
is a model method and could include extra conditions (status flag, tombstone, etc.), or it could be exactly equivalent. If the model uses Laravel's SoftDeletes trait, the original query needed
withTrashed()
to even return soft-deleted rows; verify that's still the case here, otherwise the deleted branch will literally never execute and the cleanup comment becomes a lie.
Smaller stuff:
\Throwable
became
Throwable
— make sure
use Throwable;
was added at the top of the file, otherwise it'll fatal on the catch.
The block comment now lives inside the
if (isDeleted)
branch, which reads fine and is genuinely better documentation than the old code had. Nice touch.
The
try/catch
only wraps the update path, same as before — consistent, not a regression.
Collapsing two
foreach
passes into one with an if/else is a clear readability win.
Net:
the structural refactor is good, but I'd block-and-ask on two things before approving — where did
shouldSkipActivity
go, and was the DESC ordering actually unimportant? Both deserve an explicit answer in the PR description.
Copy
Give positive feedback
Give negative feedback
Retry
You said: shouldSkipActivity is handled on different place.
You said: shouldSkipActivity is handled on different place.
shouldSkipActivity is handled on different place. What do you think about these comments A. The "Infinite Accumulation" Memory Leak
The primary goal of this refactor was memory optimization, but the implementation defeats its own purpose.
The Issue: The code iterates over the database cursor and manually unsets
$entityModel
to free memory. However, it simultaneously instantiates new
Document
objects and adds them to
$documentsToUpdate
(and IDs to
$documentsToDelete
).
The Bottleneck: These collections are not flushed or processed within the loop; they are accumulated and returned at the end of the method. If this script processes 500,000 records,
$documentsToUpdate
will hold 500,000 ElasticSearch
Document
objects in RAM at once, inevitably leading to an Out Of Memory (OOM) fatal error.
B. Laravel
cursor()
and N+1 Query Problems
Replacing
chunkByIdDesc()
with
cursor()
introduces a severe database performance risk.
The Issue: Laravel's
cursor()
executes a single query and uses a PHP generator to yield results one by one via a PDO cursor. Because it does not process models in batches,
cursor()
cannot eager-load relationships. * The Bottleneck: If
$entityModel->getIndexableAttributes()
relies on any database relationships (e.g., getting a user's company or tags), it will trigger an N+1 query. For 100,000 records, this will execute 100,001 database queries, absolutely hammering the database.
C. Long-Running PDO Connections
The Issue: Because
cursor()
keeps a single database connection open while iterating through the results, any network latency encountered inside the loop extends the transaction time.
The Bottleneck: If ElasticSearch
Document
instantiation or the Sentry API calls (on failure) take time, the PDO connection to the MariaDB database will remain open for an extended period, potentially leading to connection timeouts, blocked processes, or database lock exhaustion. and suggestions Use lazyById() instead of cursor(): * Laravel's lazyById(250) fetches records in chunks under the hood (allowing for eager loading of relations without N+1) but yields them as a flat generator to the foreach loop. This gives you the clean syntax of a generator with the safety of chunked eager loading. Dispatch to ElasticSearch Inside the Loop: * Do not wait until the end of the method to return massive collections. Keep a counter. When $documentsToUpdate reaches a certain threshold (e.g., 500 documents), dispatch them to ElasticSearch, empty the SimpleCollection, and continue the loop. Group Sentry Exceptions: Consider implementing a circuit breaker or batching error logs so that a sudden spike in formatting errors doesn't result in thousands of synchronous API calls to Sentry.
Show more
15:55
Retry
Edit
Copy
Claude responded: Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others.
Claude responded: Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others.
Evaluated reviewer critiques, distinguished regressions from preexisting issues
Evaluated reviewer critiques, distinguished regressions from preexisting issues
Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others. Going through them:
**A — Infinite Accumulation: overstated and misattributed to this PR.** Look back at the old code: `
documentsToDelete` are captured by `use(...)` in the chunk callback and accumulated across all chunks, then returned. The new code does the exact same thing. Whatever the accumulation behavior of this method is, it's identical before and after the diff. The reviewer is calling out a pre-existing architectural choice as if the refactor introduced it. The bit about "manually unsetting `$entityModel`" also looks like it's referring to code that isn't actually in the diff — `cursor()` drops references between yields automatically; you don't need an explicit `unset`. So either the reviewer is describing code that exists elsewhere in the file/method, or they're imagining it. If the accumulation is genuinely a problem at production scale, that's a separate, valid conversation — but it's not a reason to reject *this* PR.
B — N+1 with cursor(): this is the real one.
The reviewer is correct that
cursor()
interacts badly with eager loading.
chunkByIdDesc()
properly batches eager-loaded relations per chunk;
cursor()
does not get the same treatment — relations specified via
->with()
won't be batch-loaded across the cursor's lifetime in the way you'd expect. So if
getIndexableAttributes()
touches
any
relationship (and on a Searchable model that's almost a given — companies, owners, tags, custom fields, whatever), you've just turned one query plus N batched relation queries into N+1 individual queries.
This is an actual regression introduced by this PR
, not a pre-existing issue. Worth taking seriously. The fix isn't to revert — it's
lazyById()
, which the reviewer correctly identifies.
C — Long-running PDO connection: correct, and it compounds with B.
Same point I raised earlier. With
cursor()
you hold an unbuffered result set open for the entire ES + Sentry duration. If B is also happening, you're holding the connection open
and
hammering the DB with relation queries through that same connection. On MariaDB with constrained connection pools this is a recipe for "why are background workers blocking user requests."
On the suggestions:
lazyById()
is the strongest recommendation and the one that actually solves the problem. It chunks under the hood (so eager loading works properly and the connection releases between chunks), but exposes a flat generator so the cleaner single-loop structure of the new code is preserved. Cost of the change is roughly one method name. If we were keeping the refactor, this is the move.
In-loop dispatch when the buffer hits a threshold is a real improvement but it's an architectural change beyond the scope of this PR — and as noted in (A), it's a pre-existing concern, not something this PR caused. Reasonable as a follow-up ticket; not reasonable as a blocker on this one.
Sentry batching / circuit-breaker is a nice-to-have. Sentry's SDK has its own client-side throttling and the calls are HTTP. In a runaway-failure scenario it can bog down the worker, sure, but I'd want to see evidence this has actually happened before complicating the error path.
Net:
the reviewer is right about the symptom (cursor is the wrong primitive here) but is bundling that valid critique with two pre-existing concerns dressed up as regressions. If I were responding to that review I'd write something like: "Good catch on the cursor → eager loading interaction; switching to
lazyById(250)
addresses both that and the open-connection concern. The accumulation and Sentry-rate concerns are real but predate this change — I'll open separate tickets for them rather than expand this PR's scope."
Copy...
|
[{"role":"AXLink","text":& [{"role":"AXLink","text":"Skip to content","depth":14,"on_screen":true,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Skip to content","depth":15,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Click to collapse","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⌘B","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Drag to resize","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Open sidebar","depth":14,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chat","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cowork","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New chat ⌘N","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New chat","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"⌘N","depth":17,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Projects","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Artifacts","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Customize","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pinned","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"Bulgarian citizenship application process for EU residents","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Bulgarian citizenship application process for EU residents","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Dawarich location tracking project","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Dawarich location tracking project","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Recents","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXButton","text":"View all","depth":16,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code diff review","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Code diff review","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit implementation strategy","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit implementation strategy","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe retention policy code location","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe retention policy code location","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Viewing retention policy in screenpipe","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Viewing retention policy in screenpipe","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Clean shot x video recording termination issue","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Clean shot x video recording termination issue","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HubSpot rate limit handling with executeRequest","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for HubSpot rate limit handling with executeRequest","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Untitled","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 Screen pipe. Is there ability…","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 Screen pipe. Is there ability…","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"SMB mount access inconsistency between Finder and iTerm","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for SMB mount access inconsistency between Finder and iTerm","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"💬 What is the best switch I can…","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for 💬 What is the best switch I can…","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Permission denied on screenpipe volume","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Permission denied on screenpipe volume","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Screenpipe sync database attachment error","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Screenpipe sync database attachment error","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Last swimming outing with Dani","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Last swimming outing with Dani","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Definition of incarcerated","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Definition of incarcerated","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Chromecast remote volume buttons not working","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Chromecast remote volume buttons not working","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Salesforce API errors with Organization and FieldDefinition queries","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Salesforce API errors with Organization and FieldDefinition queries","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Daily activity summary from screenpipe data","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Daily activity summary from screenpipe data","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"MacBook unexpected restarts and kanji screen","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for MacBook unexpected restarts and kanji screen","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Security patch review and testing guidance","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Security patch review and testing guidance","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Food calorie values reference","depth":18,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More options for Food calorie values reference","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Relaunch to update v1.6608.0","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Relaunch to update","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"v1.6608.0","depth":16,"on_screen":true,"role_description":"text"},{"role":"AXPopUpButton","text":"Lukas Pro","depth":15,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Get apps and extensions","depth":15,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code diff review, rename chat","depth":19,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Code diff review","depth":21,"on_screen":true,"role_description":"text"},{"role":"AXPopUpButton","text":"More options for Code diff review","depth":19,"on_screen":true,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open sidebar","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share chat","depth":21,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Claude finished the response","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXHeading","text":"You said: review the diff and give me your thoughts","depth":20,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"You said: review the diff and give me your thoughts","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"1778244576295_CleanShot 2026-05-08 at 15.48.59@2x.png","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"review the diff and give me your thoughts","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"15:49","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Retry","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Edit","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Claude responded: A few observations from the diff:","depth":21,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Claude responded: A few observations from the diff:","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Scrutinized refactoring trade-offs and flagged behavioral concerns","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Scrutinized refactoring trade-offs and flagged behavioral concerns","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"A few observations from the diff:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The big one —","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"shouldSkipActivity","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is gone entirely.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The old code had logic that, for non-deleted entities, checked","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"self::shouldSkipActivity($entityModel)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and if true, added the entity to","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$documentsToDelete","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(to evict any stale ES record) and skipped indexing. The new code has no equivalent. If skip-list activity types still exist anywhere in the system, two regressions are possible: (1) they'll now get indexed when they shouldn't, and (2) any historical ES records for them won't be cleaned up. Worth confirming the skip logic moved upstream — maybe into the query builder or an observer — and isn't just dropped on the floor. If it really is intentionally removed, the PR description should call that out loudly because it's a behavioral change, not a refactor.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"chunkByIdDesc(...)","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"→","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is a meaningful change, not a cosmetic one.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"You lose the DESC ordering. If anything downstream assumed newest-first processing (priority for recent changes, deduplication where the latest write wins, etc.), that contract is now broken silently.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"chunkByIdDesc","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"re-queries per chunk with a","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"WHERE id < lastId","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor — it's resilient to the table being mutated during iteration, and each chunk releases its connection.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"holds a single unbuffered result set open for the entire iteration. On a large table, with Sentry calls and ES writes in the loop, that connection can stay open for a long time. Depending on MySQL/Postgres settings and the connection pool, that's worth a thought.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Memory-wise","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is technically lighter (one row at a time vs. RDS_CHUNK_SIZE rows), so if memory was the motivation, that tracks — but the trade-offs above should be weighed.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"whereNotNull('deleted_at')","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"→","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"isDeleted()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— these are not necessarily equivalent.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"isDeleted()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is a model method and could include extra conditions (status flag, tombstone, etc.), or it could be exactly equivalent. If the model uses Laravel's SoftDeletes trait, the original query needed","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"withTrashed()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"to even return soft-deleted rows; verify that's still the case here, otherwise the deleted branch will literally never execute and the cleanup comment becomes a lie.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Smaller stuff:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"\\Throwable","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"became","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Throwable","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"— make sure","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"use Throwable;","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"was added at the top of the file, otherwise it'll fatal on the catch.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The block comment now lives inside the","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"if (isDeleted)","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"branch, which reads fine and is genuinely better documentation than the old code had. Nice touch.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"try/catch","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"only wraps the update path, same as before — consistent, not a regression.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Collapsing two","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"foreach","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"passes into one with an if/else is a clear readability win.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Net:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"the structural refactor is good, but I'd block-and-ask on two things before approving — where did","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"shouldSkipActivity","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"go, and was the DESC ordering actually unimportant? Both deserve an explicit answer in the PR description.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Give positive feedback","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Give negative feedback","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Retry","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"You said: shouldSkipActivity is handled on different place.","depth":20,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"You said: shouldSkipActivity is handled on different place.","depth":21,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"shouldSkipActivity is handled on different place. What do you think about these comments A. The \"Infinite Accumulation\" Memory Leak\nThe primary goal of this refactor was memory optimization, but the implementation defeats its own purpose.","depth":24,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Issue: The code iterates over the database cursor and manually unsets","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$entityModel","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"to free memory. However, it simultaneously instantiates new","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Document","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"objects and adds them to","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$documentsToUpdate","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"(and IDs to","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$documentsToDelete","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":").","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Bottleneck: These collections are not flushed or processed within the loop; they are accumulated and returned at the end of the method. If this script processes 500,000 records,","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$documentsToUpdate","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"will hold 500,000 ElasticSearch","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Document","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"objects in RAM at once, inevitably leading to an Out Of Memory (OOM) fatal error.\nB. Laravel","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and N+1 Query Problems\nReplacing","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"chunkByIdDesc()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"with","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"introduces a severe database performance risk.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Issue: Laravel's","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"executes a single query and uses a PHP generator to yield results one by one via a PDO cursor. Because it does not process models in batches,","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cannot eager-load relationships. * The Bottleneck: If","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"$entityModel->getIndexableAttributes()","depth":27,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"relies on any database relationships (e.g., getting a user's company or tags), it will trigger an N+1 query. For 100,000 records, this will execute 100,001 database queries, absolutely hammering the database.\nC. Long-Running PDO Connections","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Issue: Because","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"keeps a single database connection open while iterating through the results, any network latency encountered inside the loop extends the transaction time.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The Bottleneck: If ElasticSearch","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Document","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"instantiation or the Sentry API calls (on failure) take time, the PDO connection to the MariaDB database will remain open for an extended period, potentially leading to connection timeouts, blocked processes, or database lock exhaustion. and suggestions Use lazyById() instead of cursor(): * Laravel's lazyById(250) fetches records in chunks under the hood (allowing for eager loading of relations without N+1) but yields them as a flat generator to the foreach loop. This gives you the clean syntax of a generator with the safety of chunked eager loading. Dispatch to ElasticSearch Inside the Loop: * Do not wait until the end of the method to return massive collections. Keep a counter. When $documentsToUpdate reaches a certain threshold (e.g., 500 documents), dispatch them to ElasticSearch, empty the SimpleCollection, and continue the loop. Group Sentry Exceptions: Consider implementing a circuit breaker or batching error logs so that a sudden spike in formatting errors doesn't result in thousands of synchronous API calls to Sentry.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Show more","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"15:55","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Retry","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Edit","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXHeading","text":"Claude responded: Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others.","depth":21,"on_screen":false,"role_description":"heading"},{"role":"AXStaticText","text":"Claude responded: Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others.","depth":22,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Evaluated reviewer critiques, distinguished regressions from preexisting issues","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Evaluated reviewer critiques, distinguished regressions from preexisting issues","depth":23,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others. Going through them:","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"**A — Infinite Accumulation: overstated and misattributed to this PR.** Look back at the old code: `","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"documentsToDelete` are captured by `use(...)` in the chunk callback and accumulated across all chunks, then returned. The new code does the exact same thing. Whatever the accumulation behavior of this method is, it's identical before and after the diff. The reviewer is calling out a pre-existing architectural choice as if the refactor introduced it. The bit about \"manually unsetting `$entityModel`\" also looks like it's referring to code that isn't actually in the diff — `cursor()` drops references between yields automatically; you don't need an explicit `unset`. So either the reviewer is describing code that exists elsewhere in the file/method, or they're imagining it. If the accumulation is genuinely a problem at production scale, that's a separate, valid conversation — but it's not a reason to reject *this* PR.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"B — N+1 with cursor(): this is the real one.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"The reviewer is correct that","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"interacts badly with eager loading.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"chunkByIdDesc()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"properly batches eager-loaded relations per chunk;","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"does not get the same treatment — relations specified via","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"->with()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"won't be batch-loaded across the cursor's lifetime in the way you'd expect. So if","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"getIndexableAttributes()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"touches","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"any","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"relationship (and on a Searchable model that's almost a given — companies, owners, tags, custom fields, whatever), you've just turned one query plus N batched relation queries into N+1 individual queries.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"This is an actual regression introduced by this PR","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", not a pre-existing issue. Worth taking seriously. The fix isn't to revert — it's","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lazyById()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":", which the reviewer correctly identifies.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"C — Long-running PDO connection: correct, and it compounds with B.","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Same point I raised earlier. With","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"cursor()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"you hold an unbuffered result set open for the entire ES + Sentry duration. If B is also happening, you're holding the connection open","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"and","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"hammering the DB with relation queries through that same connection. On MariaDB with constrained connection pools this is a recipe for \"why are background workers blocking user requests.\"","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"On the suggestions:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lazyById()","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"is the strongest recommendation and the one that actually solves the problem. It chunks under the hood (so eager loading works properly and the connection releases between chunks), but exposes a flat generator so the cleaner single-loop structure of the new code is preserved. Cost of the change is roughly one method name. If we were keeping the refactor, this is the move.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"In-loop dispatch when the buffer hits a threshold is a real improvement but it's an architectural change beyond the scope of this PR — and as noted in (A), it's a pre-existing concern, not something this PR caused. Reasonable as a follow-up ticket; not reasonable as a blocker on this one.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Sentry batching / circuit-breaker is a nice-to-have. Sentry's SDK has its own client-side throttling and the calls are HTTP. In a runaway-failure scenario it can bog down the worker, sure, but I'd want to see evidence this has actually happened before complicating the error path.","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Net:","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"the reviewer is right about the symptom (cursor is the wrong primitive here) but is bundling that valid critique with two pre-existing concerns dressed up as regressions. If I were responding to that review I'd write something like: \"Good catch on the cursor → eager loading interaction; switching to","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"lazyById(250)","depth":26,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"addresses both that and the open-connection concern. The accumulation and Sentry-rate concerns are real but predate this change — I'll open separate tickets for them rather than expand this PR's scope.\"","depth":25,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9079025652709912581
|
-9201559732161145700
|
app_switch
|
accessibility
|
NULL
|
Skip to content
Skip to content
Click to collapse
Skip to content
Skip to content
Click to collapse
⌘B
Drag to resize
Open sidebar
Chat
Cowork
Code
New chat ⌘N
New chat
⌘N
Projects
Artifacts
Customize
Pinned
Bulgarian citizenship application process for EU residents
More options for Bulgarian citizenship application process for EU residents
Dawarich location tracking project
More options for Dawarich location tracking project
Recents
View all
Code diff review
More options for Code diff review
HubSpot rate limit implementation strategy
More options for HubSpot rate limit implementation strategy
Screenpipe retention policy code location
More options for Screenpipe retention policy code location
Viewing retention policy in screenpipe
More options for Viewing retention policy in screenpipe
Clean shot x video recording termination issue
More options for Clean shot x video recording termination issue
HubSpot rate limit handling with executeRequest
More options for HubSpot rate limit handling with executeRequest
Untitled
More options
💬 Screen pipe. Is there ability…
More options for 💬 Screen pipe. Is there ability…
SMB mount access inconsistency between Finder and iTerm
More options for SMB mount access inconsistency between Finder and iTerm
💬 What is the best switch I can…
More options for 💬 What is the best switch I can…
Permission denied on screenpipe volume
More options for Permission denied on screenpipe volume
Screenpipe sync database attachment error
More options for Screenpipe sync database attachment error
Last swimming outing with Dani
More options for Last swimming outing with Dani
Definition of incarcerated
More options for Definition of incarcerated
Chromecast remote volume buttons not working
More options for Chromecast remote volume buttons not working
Salesforce API errors with Organization and FieldDefinition queries
More options for Salesforce API errors with Organization and FieldDefinition queries
Daily activity summary from screenpipe data
More options for Daily activity summary from screenpipe data
MacBook unexpected restarts and kanji screen
More options for MacBook unexpected restarts and kanji screen
Security patch review and testing guidance
More options for Security patch review and testing guidance
Food calorie values reference
More options for Food calorie values reference
Relaunch to update v1.6608.0
Relaunch to update
v1.6608.0
Lukas Pro
Get apps and extensions
Code diff review, rename chat
Code diff review
More options for Code diff review
Open sidebar
Share chat
Claude finished the response
You said: review the diff and give me your thoughts
You said: review the diff and give me your thoughts
1778244576295_CleanShot 2026-05-08 at [EMAIL]
review the diff and give me your thoughts
15:49
Retry
Edit
Copy
Claude responded: A few observations from the diff:
Claude responded: A few observations from the diff:
Scrutinized refactoring trade-offs and flagged behavioral concerns
Scrutinized refactoring trade-offs and flagged behavioral concerns
A few observations from the diff:
The big one —
shouldSkipActivity
is gone entirely.
The old code had logic that, for non-deleted entities, checked
self::shouldSkipActivity($entityModel)
and if true, added the entity to
$documentsToDelete
(to evict any stale ES record) and skipped indexing. The new code has no equivalent. If skip-list activity types still exist anywhere in the system, two regressions are possible: (1) they'll now get indexed when they shouldn't, and (2) any historical ES records for them won't be cleaned up. Worth confirming the skip logic moved upstream — maybe into the query builder or an observer — and isn't just dropped on the floor. If it really is intentionally removed, the PR description should call that out loudly because it's a behavioral change, not a refactor.
chunkByIdDesc(...)
→
cursor()
is a meaningful change, not a cosmetic one.
You lose the DESC ordering. If anything downstream assumed newest-first processing (priority for recent changes, deduplication where the latest write wins, etc.), that contract is now broken silently.
chunkByIdDesc
re-queries per chunk with a
WHERE id < lastId
cursor — it's resilient to the table being mutated during iteration, and each chunk releases its connection.
cursor()
holds a single unbuffered result set open for the entire iteration. On a large table, with Sentry calls and ES writes in the loop, that connection can stay open for a long time. Depending on MySQL/Postgres settings and the connection pool, that's worth a thought.
Memory-wise
cursor()
is technically lighter (one row at a time vs. RDS_CHUNK_SIZE rows), so if memory was the motivation, that tracks — but the trade-offs above should be weighed.
whereNotNull('deleted_at')
→
isDeleted()
— these are not necessarily equivalent.
isDeleted()
is a model method and could include extra conditions (status flag, tombstone, etc.), or it could be exactly equivalent. If the model uses Laravel's SoftDeletes trait, the original query needed
withTrashed()
to even return soft-deleted rows; verify that's still the case here, otherwise the deleted branch will literally never execute and the cleanup comment becomes a lie.
Smaller stuff:
\Throwable
became
Throwable
— make sure
use Throwable;
was added at the top of the file, otherwise it'll fatal on the catch.
The block comment now lives inside the
if (isDeleted)
branch, which reads fine and is genuinely better documentation than the old code had. Nice touch.
The
try/catch
only wraps the update path, same as before — consistent, not a regression.
Collapsing two
foreach
passes into one with an if/else is a clear readability win.
Net:
the structural refactor is good, but I'd block-and-ask on two things before approving — where did
shouldSkipActivity
go, and was the DESC ordering actually unimportant? Both deserve an explicit answer in the PR description.
Copy
Give positive feedback
Give negative feedback
Retry
You said: shouldSkipActivity is handled on different place.
You said: shouldSkipActivity is handled on different place.
shouldSkipActivity is handled on different place. What do you think about these comments A. The "Infinite Accumulation" Memory Leak
The primary goal of this refactor was memory optimization, but the implementation defeats its own purpose.
The Issue: The code iterates over the database cursor and manually unsets
$entityModel
to free memory. However, it simultaneously instantiates new
Document
objects and adds them to
$documentsToUpdate
(and IDs to
$documentsToDelete
).
The Bottleneck: These collections are not flushed or processed within the loop; they are accumulated and returned at the end of the method. If this script processes 500,000 records,
$documentsToUpdate
will hold 500,000 ElasticSearch
Document
objects in RAM at once, inevitably leading to an Out Of Memory (OOM) fatal error.
B. Laravel
cursor()
and N+1 Query Problems
Replacing
chunkByIdDesc()
with
cursor()
introduces a severe database performance risk.
The Issue: Laravel's
cursor()
executes a single query and uses a PHP generator to yield results one by one via a PDO cursor. Because it does not process models in batches,
cursor()
cannot eager-load relationships. * The Bottleneck: If
$entityModel->getIndexableAttributes()
relies on any database relationships (e.g., getting a user's company or tags), it will trigger an N+1 query. For 100,000 records, this will execute 100,001 database queries, absolutely hammering the database.
C. Long-Running PDO Connections
The Issue: Because
cursor()
keeps a single database connection open while iterating through the results, any network latency encountered inside the loop extends the transaction time.
The Bottleneck: If ElasticSearch
Document
instantiation or the Sentry API calls (on failure) take time, the PDO connection to the MariaDB database will remain open for an extended period, potentially leading to connection timeouts, blocked processes, or database lock exhaustion. and suggestions Use lazyById() instead of cursor(): * Laravel's lazyById(250) fetches records in chunks under the hood (allowing for eager loading of relations without N+1) but yields them as a flat generator to the foreach loop. This gives you the clean syntax of a generator with the safety of chunked eager loading. Dispatch to ElasticSearch Inside the Loop: * Do not wait until the end of the method to return massive collections. Keep a counter. When $documentsToUpdate reaches a certain threshold (e.g., 500 documents), dispatch them to ElasticSearch, empty the SimpleCollection, and continue the loop. Group Sentry Exceptions: Consider implementing a circuit breaker or batching error logs so that a sudden spike in formatting errors doesn't result in thousands of synchronous API calls to Sentry.
Show more
15:55
Retry
Edit
Copy
Claude responded: Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others.
Claude responded: Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others.
Evaluated reviewer critiques, distinguished regressions from preexisting issues
Evaluated reviewer critiques, distinguished regressions from preexisting issues
Mostly thoughtful but the framing on (A) is wrong, and there's a real point being made on (B) that deserves more weight than the others. Going through them:
**A — Infinite Accumulation: overstated and misattributed to this PR.** Look back at the old code: `
documentsToDelete` are captured by `use(...)` in the chunk callback and accumulated across all chunks, then returned. The new code does the exact same thing. Whatever the accumulation behavior of this method is, it's identical before and after the diff. The reviewer is calling out a pre-existing architectural choice as if the refactor introduced it. The bit about "manually unsetting `$entityModel`" also looks like it's referring to code that isn't actually in the diff — `cursor()` drops references between yields automatically; you don't need an explicit `unset`. So either the reviewer is describing code that exists elsewhere in the file/method, or they're imagining it. If the accumulation is genuinely a problem at production scale, that's a separate, valid conversation — but it's not a reason to reject *this* PR.
B — N+1 with cursor(): this is the real one.
The reviewer is correct that
cursor()
interacts badly with eager loading.
chunkByIdDesc()
properly batches eager-loaded relations per chunk;
cursor()
does not get the same treatment — relations specified via
->with()
won't be batch-loaded across the cursor's lifetime in the way you'd expect. So if
getIndexableAttributes()
touches
any
relationship (and on a Searchable model that's almost a given — companies, owners, tags, custom fields, whatever), you've just turned one query plus N batched relation queries into N+1 individual queries.
This is an actual regression introduced by this PR
, not a pre-existing issue. Worth taking seriously. The fix isn't to revert — it's
lazyById()
, which the reviewer correctly identifies.
C — Long-running PDO connection: correct, and it compounds with B.
Same point I raised earlier. With
cursor()
you hold an unbuffered result set open for the entire ES + Sentry duration. If B is also happening, you're holding the connection open
and
hammering the DB with relation queries through that same connection. On MariaDB with constrained connection pools this is a recipe for "why are background workers blocking user requests."
On the suggestions:
lazyById()
is the strongest recommendation and the one that actually solves the problem. It chunks under the hood (so eager loading works properly and the connection releases between chunks), but exposes a flat generator so the cleaner single-loop structure of the new code is preserved. Cost of the change is roughly one method name. If we were keeping the refactor, this is the move.
In-loop dispatch when the buffer hits a threshold is a real improvement but it's an architectural change beyond the scope of this PR — and as noted in (A), it's a pre-existing concern, not something this PR caused. Reasonable as a follow-up ticket; not reasonable as a blocker on this one.
Sentry batching / circuit-breaker is a nice-to-have. Sentry's SDK has its own client-side throttling and the calls are HTTP. In a runaway-failure scenario it can bog down the worker, sure, but I'd want to see evidence this has actually happened before complicating the error path.
Net:
the reviewer is right about the symptom (cursor is the wrong primitive here) but is bundling that valid critique with two pre-existing concerns dressed up as regressions. If I were responding to that review I'd write something like: "Good catch on the cursor → eager loading interaction; switching to
lazyById(250)
addresses both that and the open-connection concern. The accumulation and Sentry-rate concerns are real but predate this change — I'll open separate tickets for them rather than expand this PR's scope."
Copy...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
21147
|
923
|
38
|
2026-05-11T17:15:20.074204+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778519720074_m2.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.5046542,"top":0.061452515,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.51263297,"top":0.08140463,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.51263297,"top":0.103751,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.51263297,"top":0.12609737,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.51263297,"top":0.14844373,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.51263297,"top":0.1707901,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.51263297,"top":0.19313647,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.51263297,"top":0.21548285,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.5046542,"top":0.2434158,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.51263297,"top":0.26336792,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.51263297,"top":0.2857143,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.5046542,"top":0.31364724,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.51263297,"top":0.33359936,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.55651593,"top":0.33519554,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.51263297,"top":0.35594574,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.5046542,"top":0.38387868,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.51263297,"top":0.4038308,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.51263297,"top":0.42617717,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.51263297,"top":0.44852355,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.51263297,"top":0.4708699,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.51263297,"top":0.49321628,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.51263297,"top":0.51556265,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.51263297,"top":0.53790903,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.51263297,"top":0.5602554,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.5827792,"top":0.08858739,"width":0.011968086,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.8656915,"top":0.08858739,"width":0.025930852,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.92586434,"top":0.08858739,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.9581117,"top":0.08858739,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"bounds":{"left":0.5711436,"top":0.083798885,"width":0.29288563,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"bounds":{"left":0.8640292,"top":0.083798885,"width":0.06017287,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"bounds":{"left":0.92420214,"top":0.083798885,"width":0.032247342,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"bounds":{"left":0.95644945,"top":0.083798885,"width":0.040226065,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"bounds":{"left":0.57081115,"top":0.06624102,"width":0.02825798,"height":0.011971269},"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"bounds":{"left":0.9684175,"top":0.065442935,"width":0.027925532,"height":0.015163607},"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":0.77360374,"top":0.98324025,"width":0.016954787,"height":0.011173184},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"bounds":{"left":0.5990692,"top":0.019952115,"width":0.14378324,"height":0.0415004},"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
visual_change
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
21146
|
NULL
|
NULL
|
NULL
|
|
21156
|
922
|
34
|
2026-05-11T17:15:39.571233+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778519739571_m1.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":1.0,"top":0.0,"width":-0.05138886,"height":0.015555556},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
21155
|
NULL
|
NULL
|
NULL
|
|
21157
|
923
|
43
|
2026-05-11T17:15:39.541278+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-11/1778 /Users/lukas/.screenpipe/data/data/2026-05-11/1778519739541_m2.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.5046542,"top":0.0622506,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.51263297,"top":0.08220271,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.51263297,"top":0.10454908,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.51263297,"top":0.12689546,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.51263297,"top":0.14924182,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.51263297,"top":0.17158818,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.51263297,"top":0.19393456,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.51263297,"top":0.21628092,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.5046542,"top":0.2442139,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.51263297,"top":0.264166,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.51263297,"top":0.28651237,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.5046542,"top":0.31444532,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.51263297,"top":0.33439744,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.55651593,"top":0.33599362,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.51263297,"top":0.3567438,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.5046542,"top":0.38467678,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.51263297,"top":0.4046289,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.51263297,"top":0.42697525,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.51263297,"top":0.44932163,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.51263297,"top":0.471668,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.51263297,"top":0.49401435,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.51263297,"top":0.51636076,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.51263297,"top":0.5387071,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.51263297,"top":0.56105345,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.5827792,"top":0.08938547,"width":0.011968086,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.8656915,"top":0.08938547,"width":0.025930852,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.92586434,"top":0.08938547,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.9581117,"top":0.08938547,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"bounds":{"left":0.5711436,"top":0.08459697,"width":0.29288563,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"bounds":{"left":0.8640292,"top":0.08459697,"width":0.06017287,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"bounds":{"left":0.92420214,"top":0.08459697,"width":0.032247342,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"bounds":{"left":0.95644945,"top":0.08459697,"width":0.040226065,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"bounds":{"left":0.57081115,"top":0.06703911,"width":0.02825798,"height":0.011971269},"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"bounds":{"left":0.9684175,"top":0.06624102,"width":0.027925532,"height":0.015163607},"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":0.77360374,"top":0.9840383,"width":0.016954787,"height":0.011173184},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"bounds":{"left":0.5990692,"top":0.0207502,"width":0.14378324,"height":0.0415004},"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
7070
|
318
|
3
|
2026-05-08T08:13:40.606967+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778228020606_m2.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.1924867,"top":0.32402235,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.20046543,"top":0.34397447,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.20046543,"top":0.36632082,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.20046543,"top":0.3886672,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.20046543,"top":0.41101357,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.20046543,"top":0.43335995,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.20046543,"top":0.4557063,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.20046543,"top":0.47805268,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.1924867,"top":0.5059856,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.20046543,"top":0.52593774,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.20046543,"top":0.5482841,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.1924867,"top":0.57621706,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.20046543,"top":0.5961692,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.2443484,"top":0.5977654,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.20046543,"top":0.61851555,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.1924867,"top":0.64644855,"width":0.06216755,"height":0.015163607},"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.20046543,"top":0.6664006,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.20046543,"top":0.688747,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.20046543,"top":0.71109337,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.20046543,"top":0.73343974,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.20046543,"top":0.7557861,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.20046543,"top":0.7781325,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.20046543,"top":0.8004789,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.20046543,"top":0.8228252,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.2706117,"top":0.35115722,"width":0.011968086,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.36236703,"top":0.35115722,"width":0.025930852,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.4225399,"top":0.35115722,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.45478722,"top":0.35115722,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"bounds":{"left":0.25897607,"top":0.3463687,"width":0.10172872,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"bounds":{"left":0.36070478,"top":0.3463687,"width":0.06017287,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"bounds":{"left":0.42087767,"top":0.3463687,"width":0.032247342,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"bounds":{"left":0.453125,"top":0.3463687,"width":0.040226065,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"bounds":{"left":0.25864363,"top":0.32881084,"width":0.02825798,"height":0.011971269},"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"bounds":{"left":0.46210107,"top":0.32801276,"width":0.027925532,"height":0.015163607},"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":0.3643617,"top":0.61372703,"width":0.016954787,"height":0.011173184},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"bounds":{"left":0.2869016,"top":0.28252193,"width":0.06948138,"height":0.0415004},"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
visual_change
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
7068
|
NULL
|
NULL
|
NULL
|
|
7071
|
317
|
5
|
2026-05-08T08:13:40.698493+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-08/1778 /Users/lukas/.screenpipe/data/data/2026-05-08/1778228020698_m1.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
5393
|
194
|
20
|
2026-05-07T15:22:59.082890+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778167379082_m2.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.4870346,"top":0.367917,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.4950133,"top":0.38786912,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.4950133,"top":0.4102155,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.4950133,"top":0.43256184,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.4950133,"top":0.45490822,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.4950133,"top":0.4772546,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.4950133,"top":0.49960095,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.4950133,"top":0.5219473,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.4870346,"top":0.54988027,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.4950133,"top":0.5698324,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.4950133,"top":0.59217876,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.4870346,"top":0.6201117,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.4950133,"top":0.6400638,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.53889626,"top":0.64166003,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.4950133,"top":0.6624102,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.4870346,"top":0.6903432,"width":0.06216755,"height":0.015163607},"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.4950133,"top":0.7102953,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.4950133,"top":0.73264164,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.4950133,"top":0.754988,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.4950133,"top":0.7773344,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.4950133,"top":0.79968077,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.4950133,"top":0.82202715,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.4950133,"top":0.8443735,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.4950133,"top":0.8667199,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.56515956,"top":0.39505187,"width":0.011968086,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.6569149,"top":0.39505187,"width":0.025930852,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.71708775,"top":0.39505187,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.7493351,"top":0.39505187,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"bounds":{"left":0.55352396,"top":0.39026338,"width":0.10172872,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"bounds":{"left":0.65525264,"top":0.39026338,"width":0.06017287,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"bounds":{"left":0.71542555,"top":0.39026338,"width":0.032247342,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"bounds":{"left":0.74767286,"top":0.39026338,"width":0.040226065,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"bounds":{"left":0.5531915,"top":0.37270552,"width":0.02825798,"height":0.011971269},"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"bounds":{"left":0.75664896,"top":0.3719074,"width":0.027925532,"height":0.015163607},"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":0.65890956,"top":0.6576217,"width":0.016954787,"height":0.011173184},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"bounds":{"left":0.58144945,"top":0.3264166,"width":0.06948138,"height":0.0415004},"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
5392
|
NULL
|
NULL
|
NULL
|
|
5394
|
193
|
14
|
2026-05-07T15:22:59.083002+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-07/1778 /Users/lukas/.screenpipe/data/data/2026-05-07/1778167379083_m1.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
75182
|
2663
|
18
|
2026-05-27T08:10:48.137409+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-27/1779 /Users/lukas/.screenpipe/data/data/2026-05-27/1779869448137_m2.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.54388297,"top":0.15243416,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.5518617,"top":0.17238627,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.5518617,"top":0.19473264,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.5518617,"top":0.21707901,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.5518617,"top":0.23942538,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.5518617,"top":0.26177174,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.5518617,"top":0.28411812,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.5518617,"top":0.3064645,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.54388297,"top":0.33439744,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.5518617,"top":0.35434955,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.5518617,"top":0.37669593,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.54388297,"top":0.4046289,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.5518617,"top":0.424581,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.59574467,"top":0.42617717,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.5518617,"top":0.44692737,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.54388297,"top":0.47486034,"width":0.06216755,"height":0.015163607},"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.5518617,"top":0.49481246,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.5518617,"top":0.5171588,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.5518617,"top":0.5395052,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.5518617,"top":0.56185156,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.5518617,"top":0.58419794,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.5518617,"top":0.6065443,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.5518617,"top":0.62889063,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.5518617,"top":0.651237,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.62200797,"top":0.17956904,"width":0.011968086,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.7137633,"top":0.17956904,"width":0.025930852,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.77393615,"top":0.17956904,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.8061835,"top":0.17956904,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"bounds":{"left":0.61037236,"top":0.17478053,"width":0.10172872,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"bounds":{"left":0.71210104,"top":0.17478053,"width":0.06017287,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"bounds":{"left":0.77227396,"top":0.17478053,"width":0.032247342,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"bounds":{"left":0.80452126,"top":0.17478053,"width":0.040226065,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"bounds":{"left":0.6100399,"top":0.15722266,"width":0.02825798,"height":0.011971269},"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"bounds":{"left":0.81349736,"top":0.15642458,"width":0.027925532,"height":0.015163607},"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":0.71575797,"top":0.44213888,"width":0.016954787,"height":0.011173184},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"bounds":{"left":0.63829786,"top":0.11093376,"width":0.06948138,"height":0.0415004},"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
75181
|
NULL
|
NULL
|
NULL
|
|
76294
|
2689
|
33
|
2026-05-27T09:37:17.362188+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-27/1779 /Users/lukas/.screenpipe/data/data/2026-05-27/1779874637362_m2.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"bounds":{"left":0.54388297,"top":0.15243416,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"bounds":{"left":0.5518617,"top":0.17238627,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"bounds":{"left":0.5518617,"top":0.19473264,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"bounds":{"left":0.5518617,"top":0.21707901,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"bounds":{"left":0.5518617,"top":0.23942538,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"bounds":{"left":0.5518617,"top":0.26177174,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"bounds":{"left":0.5518617,"top":0.28411812,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"bounds":{"left":0.5518617,"top":0.3064645,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"bounds":{"left":0.54388297,"top":0.33439744,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"bounds":{"left":0.5518617,"top":0.35434955,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"bounds":{"left":0.5518617,"top":0.37669593,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"bounds":{"left":0.54388297,"top":0.4046289,"width":0.06216755,"height":0.015163607},"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"bounds":{"left":0.5518617,"top":0.424581,"width":0.043218084,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"bounds":{"left":0.59574467,"top":0.42617717,"width":0.0043218085,"height":0.009577015},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"bounds":{"left":0.5518617,"top":0.44692737,"width":0.049534574,"height":0.012769354},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"bounds":{"left":0.54388297,"top":0.47486034,"width":0.06216755,"height":0.015163607},"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"bounds":{"left":0.5518617,"top":0.49481246,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"bounds":{"left":0.5518617,"top":0.5171588,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"bounds":{"left":0.5518617,"top":0.5395052,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"bounds":{"left":0.5518617,"top":0.56185156,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"bounds":{"left":0.5518617,"top":0.58419794,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"bounds":{"left":0.5518617,"top":0.6065443,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"bounds":{"left":0.5518617,"top":0.62889063,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"bounds":{"left":0.5518617,"top":0.651237,"width":0.049534574,"height":0.012769354},"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"bounds":{"left":0.62200797,"top":0.17956904,"width":0.011968086,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"bounds":{"left":0.7137633,"top":0.17956904,"width":0.025930852,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"bounds":{"left":0.77393615,"top":0.17956904,"width":0.008976064,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"bounds":{"left":0.8061835,"top":0.17956904,"width":0.00930851,"height":0.011173184},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"bounds":{"left":0.61037236,"top":0.17478053,"width":0.10172872,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"bounds":{"left":0.71210104,"top":0.17478053,"width":0.06017287,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"bounds":{"left":0.77227396,"top":0.17478053,"width":0.032247342,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"bounds":{"left":0.80452126,"top":0.17478053,"width":0.040226065,"height":0.022346368},"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"bounds":{"left":0.6100399,"top":0.15722266,"width":0.02825798,"height":0.011971269},"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"bounds":{"left":0.81349736,"top":0.15642458,"width":0.027925532,"height":0.015163607},"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"bounds":{"left":0.71575797,"top":0.44213888,"width":0.016954787,"height":0.011173184},"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"bounds":{"left":0.63829786,"top":0.11093376,"width":0.06948138,"height":0.0415004},"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
76292
|
NULL
|
NULL
|
NULL
|
|
80305
|
2800
|
56
|
2026-05-28T07:08:45.756023+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-28/1779 /Users/lukas/.screenpipe/data/data/2026-05-28/1779952125756_m1.jpg...
|
Finder
|
DXP4800PLUS-B5F
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Favourites","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"jiminny","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"AirDrop","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Recents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Applications","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Documents","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Downloads","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"lukas","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"iCloud","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"iCloud Drive","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Sync folder","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Locations","depth":6,"on_screen":true,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Eject","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Network","depth":6,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Tags","depth":6,"on_screen":false,"automation_id":"xSidebarHeader","role_description":"text"},{"role":"AXStaticText","text":"CRM","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Orange","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Red","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Yellow","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Green","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Blue","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Purple","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"All Tags…","depth":6,"on_screen":false,"role_description":"text"},{"role":"AXStaticText","text":"Name","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Date Modified","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Size","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"Kind","depth":7,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Name","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Date Modified","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Size","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXButton","text":"Kind","depth":6,"on_screen":true,"role_description":"sort button","subrole":"AXSortButton","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"Connecting…","depth":2,"on_screen":true,"automation_id":"_NS:10","role_description":"text"},{"role":"AXButton","text":"Connect As…","depth":2,"on_screen":true,"automation_id":"_NS:38","role_description":"button","is_enabled":true,"is_focused":false},{"role":"AXStaticText","text":"0 items","depth":2,"on_screen":true,"automation_id":"_NS:34","role_description":"text"},{"role":"AXStaticText","text":"DXP4800PLUS-B5F","depth":1,"on_screen":true,"role_description":"text"}]...
|
9078953297810257490
|
-1839682751016964195
|
click
|
accessibility
|
NULL
|
Favourites
jiminny
AirDrop
Recents
Applications
Do Favourites
jiminny
AirDrop
Recents
Applications
Documents
Downloads
lukas
iCloud
iCloud Drive
Sync folder
Locations
DXP4800PLUS-B5F
Eject
Network
Tags
CRM
Orange
Red
Yellow
Green
Blue
Purple
All Tags…
Name
Date Modified
Size
Kind
Name
Date Modified
Size
Kind
Connecting…
Connect As…
0 items
DXP4800PLUS-B5F...
|
80302
|
NULL
|
NULL
|
NULL
|
|
119
|
8
|
19
|
2026-05-06T17:45:44.169582+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-06/1778 /Users/lukas/.screenpipe/data/data/2026-05-06/1778089544169_m2.jpg...
|
iTerm2
|
NULL
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
DMSrireroxcalVIewhistorybookmarksProtllesHelpAC.MI DMSrireroxcalVIewhistorybookmarksProtllesHelpAC.MILVAll 4DMsloastApp[no preview availablel11 | 10:00 AMIMonday. May 4th-7 Jira Cloud@ 15 Monday@Nikolay Ivanov transitioned aBug you are watching from Code...Wednesday, April 29thAneliva AngelovaWednesdayStoyan Tanev6 DMWednesdavнаша стоананTuesday. April 28th?1 Stefka StoyanovaApr 28thтия тикети е добре да влезнат вдругия спринт ли? сложете някакви...Ves@ Thread in DM: исках да те...смени го в Circle Cl env на новиятокон който си наппарилApr 28thStefka Stoyano… Replied Apr 28thAOMIприятна отпуска ®Stetka Stovanova and …... Aor 28thlWindow* → CN& Adelina Petrova "Pull requests • screenpipe/screenpipe - GitHubMessagesLo Add canvasUr Files# Hostinger login | Sign in to Hostinger accountне, само стр се тракватLogin - Nginx Proxy ManagerLukas Kovalik IN 1:15 PM* Screenpipe - ArchiveAdelina Petrova "T 1:42 PMpagesLukas Kovalik "T 1:43 PMЯСНО@ SQLite Web: archive.db©SQLite Web: db.sqliteAdelina Petrova 5:06 PMда не ои проолема да е заради това кю: QUEUE,DELAYA- New TabLukas Kovalik * 5:06 PMscreenpipe/,claude/skills at main • screenpipe/screenpза това искам да дооавя логовеAdelina Petrova 5:07 PMUAVDA MO CTAUG SUA rA MaVUOLI?има ли риск за нещоLukas Kovalik " 5:08 PMвсишност нама опашка тукаAdelina Petrova " 5:12 PM• сега, няма ли ла сложи евента в това кю и ла чака изпьлLukas Kovalik *T 5:21 PMла, ше оставя detault изпь лнениеLukas Kovalik 1K 5-26 PMпо поинцип го направих като nudge-created че те не са оl•и глелам че и този event няма никойAdelina Petrova 5:33PMспорел мен пробвай без това кюLukas Kovalik * 5:33 PMhttps://run.userpilot.io/events/tracked_event/10run.userpilot.ioUserpilotUserpilot helos product teams deliver personalized in-appgrowth metrics at every stage of the user lournev.не е това обаче, гледам че всички си минават през сьщиAdelina Petrova * 5:40 PMами эко можеш сложи тогава лог да го видимAdelina Petrova has paused their notificationsMessage Adelina Petrova " VacationingAaO Not Secure http:/[IP_ADDRESS]:8768/audio_transcriptions_fts_idx/auaio taasaudio_transcriptionsaudio_transcriptions_fts (v)audio_transcriptions_.102008 2-= ArchiveCREATE TABLE 'audio_transcriptions_fts_idx' (segid,cerm,PRIMARY KEV(segid, term)ColumnsColumnsegidtermpgnoIndexesNameData typeColumnsSQLite database browser vO.7.2, powered by Flask and Peewee. © 2026 Charles LeiferAllow nullframesframes_fts (v)frames_fts_configframes_fts_dataframes_fts_idxmeetingsmemoriesmemories_fts (v)memories_fts_configmemories_fts_datamemories_fts_idxocr_textpipe_executionspipe_scheduler_statesecretsspeaker_embeddingsspeakerssalite_sequencesqlite_stat1sqlite_stat4tagsui_eventsui_events_fts (v)ui_events_fts_configui_events_fts_dataui_events_fts_idxvideo_chunksvision_tagsToggle helper tablesUniqueOOOAA 94 8 WedGMay 20:45:44Primary keySQLActionsread-onlvread-onlyread-onlyDrop?...
|
NULL
|
9078799362634377419
|
NULL
|
idle
|
ocr
|
NULL
|
DMSrireroxcalVIewhistorybookmarksProtllesHelpAC.MI DMSrireroxcalVIewhistorybookmarksProtllesHelpAC.MILVAll 4DMsloastApp[no preview availablel11 | 10:00 AMIMonday. May 4th-7 Jira Cloud@ 15 Monday@Nikolay Ivanov transitioned aBug you are watching from Code...Wednesday, April 29thAneliva AngelovaWednesdayStoyan Tanev6 DMWednesdavнаша стоананTuesday. April 28th?1 Stefka StoyanovaApr 28thтия тикети е добре да влезнат вдругия спринт ли? сложете някакви...Ves@ Thread in DM: исках да те...смени го в Circle Cl env на новиятокон който си наппарилApr 28thStefka Stoyano… Replied Apr 28thAOMIприятна отпуска ®Stetka Stovanova and …... Aor 28thlWindow* → CN& Adelina Petrova "Pull requests • screenpipe/screenpipe - GitHubMessagesLo Add canvasUr Files# Hostinger login | Sign in to Hostinger accountне, само стр се тракватLogin - Nginx Proxy ManagerLukas Kovalik IN 1:15 PM* Screenpipe - ArchiveAdelina Petrova "T 1:42 PMpagesLukas Kovalik "T 1:43 PMЯСНО@ SQLite Web: archive.db©SQLite Web: db.sqliteAdelina Petrova 5:06 PMда не ои проолема да е заради това кю: QUEUE,DELAYA- New TabLukas Kovalik * 5:06 PMscreenpipe/,claude/skills at main • screenpipe/screenpза това искам да дооавя логовеAdelina Petrova 5:07 PMUAVDA MO CTAUG SUA rA MaVUOLI?има ли риск за нещоLukas Kovalik " 5:08 PMвсишност нама опашка тукаAdelina Petrova " 5:12 PM• сега, няма ли ла сложи евента в това кю и ла чака изпьлLukas Kovalik *T 5:21 PMла, ше оставя detault изпь лнениеLukas Kovalik 1K 5-26 PMпо поинцип го направих като nudge-created че те не са оl•и глелам че и този event няма никойAdelina Petrova 5:33PMспорел мен пробвай без това кюLukas Kovalik * 5:33 PMhttps://run.userpilot.io/events/tracked_event/10run.userpilot.ioUserpilotUserpilot helos product teams deliver personalized in-appgrowth metrics at every stage of the user lournev.не е това обаче, гледам че всички си минават през сьщиAdelina Petrova * 5:40 PMами эко можеш сложи тогава лог да го видимAdelina Petrova has paused their notificationsMessage Adelina Petrova " VacationingAaO Not Secure http:/[IP_ADDRESS]:8768/audio_transcriptions_fts_idx/auaio taasaudio_transcriptionsaudio_transcriptions_fts (v)audio_transcriptions_.102008 2-= ArchiveCREATE TABLE 'audio_transcriptions_fts_idx' (segid,cerm,PRIMARY KEV(segid, term)ColumnsColumnsegidtermpgnoIndexesNameData typeColumnsSQLite database browser vO.7.2, powered by Flask and Peewee. © 2026 Charles LeiferAllow nullframesframes_fts (v)frames_fts_configframes_fts_dataframes_fts_idxmeetingsmemoriesmemories_fts (v)memories_fts_configmemories_fts_datamemories_fts_idxocr_textpipe_executionspipe_scheduler_statesecretsspeaker_embeddingsspeakerssalite_sequencesqlite_stat1sqlite_stat4tagsui_eventsui_events_fts (v)ui_events_fts_configui_events_fts_dataui_events_fts_idxvideo_chunksvision_tagsToggle helper tablesUniqueOOOAA 94 8 WedGMay 20:45:44Primary keySQLActionsread-onlvread-onlyread-onlyDrop?...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
40236
|
1485
|
29
|
2026-05-14T08:28:22.051145+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778747302051_m1.jpg...
|
PhpStorm
|
faVsco.js – PayloadBuilder.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
25
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use Carbon\Carbon;
use Jiminny\Models\Crm\Configuration;
use Psr\Log\LoggerInterface;
class PayloadBuilder
{
public const int MAX_SEARCH_REQUEST_LIMIT = 200;
private const int MAX_FILTER_SIZE = 100;
private const string SORT_PROPERTY = 'hs_timestamp';
private const string ENGAGEMENT_MEETINGS = 'meetings';
public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($engagementType === self::ENGAGEMENT_MEETINGS) {
$payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_timestamp',
'hs_activity_type',
];
} else {
$payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = ['hs_task_subject', 'hs_timestamp'];
}
return $payload;
}
public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array
{
$lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array
{
$lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
[
'propertyName' => 'hubspot_owner_id',
'operator' => 'EQ',
'value' => $crmId,
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array
{
$filters = [];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'IN',
'values' => ['SCHEDULED', 'RESCHEDULED'],
],
],
];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'NOT_HAS_PROPERTY',
],
],
];
return $filters;
}
private function buildTaskFiltersForLinkToTask($objectType, $objectId): array
{
return [
[
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
],
],
];
}
private function getAssociatedObjectFilter(string $objectType, string $objectId): array
{
return [
'propertyName' => 'associations.' . $objectType,
'operator' => 'EQ',
'value' => $objectId,
];
}
public function generatePlaybackURLSearchPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $activityProvider,
],
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => $this->getSearchCallAttributes(),
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function getSearchCallAttributes(): array
{
return [
'hs_timestamp',
'hs_call_recording_url',
'hs_call_body',
'hs_call_status',
'hs_call_to_number',
'hs_call_from_number',
'hs_call_duration',
'hs_call_disposition',
'hs_call_title',
'hs_call_direction',
'hubspot_owner_id',
'hs_activity_type',
'hs_call_external_id',
'hs_call_source',
];
}
public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array
{
$updateObjectsData = [];
foreach ($crmUpdateData as $data) {
$updateObjectsData[] = [
'id' => $data['crm_id'],
'properties' => [
'hs_call_body' => $data['hs_call_body'] .
'<p><span style="font-size: 13.3333px; line-height: 16px;">' .
'<a href="' . $data['playback_url'] . '" target="_blank">Review in Jiminny</a> ▶️</span></p>',
],
];
}
return ['inputs' => $updateObjectsData];
}
public function generateSearchCallByTokenPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
/**
* Generates a payload for phone search based on the specified parameters.
*
* @param string $phone The phone number to search.
* @param bool $isAlternativeSearch Indicates if an alternative search should be performed
* if the first search fails to find a match. The first search request should cover most of the cases.
*/
public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array
{
$filterPropertyNames = $isAlternativeSearch ?
['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :
['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];
$filterGroups = array_map(function ($propertyName) use ($phone) {
return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);
}, $filterPropertyNames);
$properties = [
'email',
'firstname',
'lastname',
'country',
'phone',
'mobilephone',
'jobtitle',
'hubspot_owner_id',
'associatedcompanyid',
'photo',
];
return $this->createPayload($filterGroups, $properties);
}
/**
* Creates a filter group with the specified parameters.
*/
private function createFilterGroup(string $propertyName, string $operator, $value): array
{
return [
'filters' => [
[
'propertyName' => $propertyName,
'operator' => $operator,
'value' => $value,
],
],
];
}
/**
* Creates a payload with the specified filter groups and properties.
*/
private function createPayload(array $filterGroups, array $properties): array
{
return [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => 'modifieddate',
'direction' => 'DESCENDING',
],
],
'properties' => $properties,
'limit' => 1,
];
}
/**
* Generates a payload to find related activities based on the specified data and object type.
* The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)
* and are associated with any of the provided prospect types (contact or company).
*
* @param array $data An associative array containing the following keys:
* - 'from': The start time for the activity search (timestamp).
* - 'to': The end time for the activity search (timestamp).
* - 'contact': (optional) The ID of the associated contact.
* - 'company': (optional) The ID of the associated company.
* @param string $objectType The type of engagement to search for (meeting or other type like call).
*
* @return array The payload array to be used for searching related activities.
*/
public function getFindRelatedActivityPayload(array $data, string $objectType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($objectType === self::ENGAGEMENT_MEETINGS) {
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_activity_type',
'hs_timestamp',
'hubspot_owner_id',
'hs_meeting_body',
'hs_internal_meeting_notes',
'hs_meeting_location',
'hs_meeting_start_time',
'hs_meeting_end_time',
];
} else {
$payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];
}
$timeFiltersWithEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'LTE',
'value' => $data['to'],
],
];
$timeFiltersWithoutEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'NOT_HAS_PROPERTY',
],
];
$payload['filterGroups'] = [];
$associationTypes = ['contact', 'company'];
foreach ($associationTypes as $type) {
if (! empty($data[$type])) {
$filterGroupWithEndTime = [
'filters' => array_merge(
$timeFiltersWithEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithEndTime;
$filterGroupWithoutEndTime = [
'filters' => array_merge(
$timeFiltersWithoutEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithoutEndTime ;
}
}
return $payload;
}
/** Parameters
* [
* 'accountId' => $crmAccountId,
* 'sortBy' => $sortBy,
* 'sortDir' => $sortDir,
* 'onlyOpen' => $onlyOpen,
* 'closedStages' => $this->getClosedDealStages(),
* 'userId' => $userId,
* ];
*/
public function generateOpportunitiesSearchPayload(
Configuration $config,
string $crmAccountId,
array $closedStages,
): array {
$closedFilters = [];
$filterGroups = [];
$onlyOpen = true;
switch ($config->getOpportunityAssignmentRule()) {
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:
$sortBy = 'createdate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:
$sortBy = 'createdate';
$sortDir = 'ASCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:
default:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
$onlyOpen = false;
}
$baseFilters = [
[
'propertyName' => 'associations.company',
'operator' => 'EQ',
'value' => $crmAccountId,
],
];
// Handle closed stages in chunks
if ($onlyOpen) {
foreach (['won', 'lost'] as $key) {
if (! empty($closedStages[$key])) {
$chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);
foreach ($chunks as $chunk) {
$closedFilters[] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $chunk,
];
}
}
}
}
$filterGroups[] = [
'filters' => array_merge($baseFilters, $closedFilters),
];
$payload = [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => $sortBy,
'direction' => $sortDir,
],
],
'properties' => [
'dealname',
'amount',
'hubspot_owner_id',
'pipeline',
'dealstage',
'closedate',
'deal_currency_code',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
$logger = app(LoggerInterface::class);
$logger->info('[HubSpot] CRM Search requested', [
'request' => $payload,
]);
return $payload;
}
/**
* Converts v1 payload data to v3
*/
public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array
{
// Use this mapping until the whole Hubspot V1 is dropped.
$properties = [
'hubspot_owner_id' => $engagement['ownerId'],
'hs_timestamp' => $engagement['timestamp'],
];
// $engagement['activityType'] is $activity->category->name
if (isset($engagement['activityType'])) {
$properties['hs_activity_type'] = $engagement['activityType'];
}
$metadataKeyMap = [
'hs_meeting_outcome' => 'meetingOutcome',
'hs_meeting_title' => 'title',
'hs_meeting_start_time' => 'startTime',
'hs_meeting_end_time' => 'endTime',
'hs_meeting_body' => 'body',
'hs_internal_meeting_notes' => 'internalMeetingNotes',
];
foreach ($metadataKeyMap as $newKey => $oldKey) {
if (isset($metadata[$oldKey])) {
$properties[$newKey] = $metadata[$oldKey];
unset($metadata[$oldKey]);
}
}
$properties = [
...$properties,
...$metadata, // custom fields
];
$response = [
'properties' => $properties,
];
if (! empty($associations)) {
$response['associations'] = $associations;
}
return $response;
}
/**
* Generate a payload to search for contacts by name.
* The search is a token search in firstname or lastname
*/
public function generateSearchContactsByNamePayload(string $name, array $fields): array
{
$firstNameFilter = [
'propertyName' => 'firstname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
$lastNameFilter = [
'propertyName' => 'lastname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
return [
'filterGroups' => [
[
'filters' => [$firstNameFilter],
],
[
'filters' => [$lastNameFilter],
],
],
'properties' => $fields,
'sorts' => [
[
'propertyName' => 'lastmodifieddate',
'direction' => 'DESCENDING',
],
],
];
}
public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array
{
$inputs = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$inputs[] = [
'from' => [
'id' => $crmId,
],
'to' => [
'id' => (string) $id,
],
'types' => [
[
'associationCategory' => 'HUBSPOT_DEFINED',
'associationTypeId' => $associationType,
],
],
];
}
return ['inputs' => $inputs];
}
public function buildRemoveAssociationPayload(string $crmId, array $ids): array
{
$toArray = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$toArray[] = ['id' => (string) $id];
}
return [
'inputs' => [
[
'from' => ['id' => $crmId],
'to' => $toArray,
],
],
];
}
public function addClosedStageFilters(array &$payload, array $closedStages): void
{
if (! empty($closedStages['won'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['won'],
];
}
if (! empty($closedStages['lost'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['lost'],
];
}
}
public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void
{
$payload['filters'][] = [
'propertyName' => 'createdate',
'operator' => 'GT',
'value' => $createdAfter->getPreciseTimestamp(3),
];
}
public function getDealsInBulkPayload(array $dealIds): array
{
return [
'filterGroups' => [
[
'filters' => [
[
'propertyName' => 'hs_object_id',
'operator' => 'IN',
'values' => $dealIds,
],
],
],
],
'limit' => self::MAX_FILTER_SIZE,
];
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"25","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Psr\\Log\\LoggerInterface;\n\nclass PayloadBuilder\n{\n public const int MAX_SEARCH_REQUEST_LIMIT = 200;\n\n private const int MAX_FILTER_SIZE = 100;\n\n private const string SORT_PROPERTY = 'hs_timestamp';\n private const string ENGAGEMENT_MEETINGS = 'meetings';\n\n public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($engagementType === self::ENGAGEMENT_MEETINGS) {\n $payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_timestamp',\n 'hs_activity_type',\n ];\n } else {\n $payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp'];\n }\n\n return $payload;\n }\n\n public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array\n {\n $lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array\n {\n $lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n [\n 'propertyName' => 'hubspot_owner_id',\n 'operator' => 'EQ',\n 'value' => $crmId,\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array\n {\n $filters = [];\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'IN',\n 'values' => ['SCHEDULED', 'RESCHEDULED'],\n ],\n ],\n ];\n\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ],\n ];\n\n return $filters;\n }\n\n private function buildTaskFiltersForLinkToTask($objectType, $objectId): array\n {\n return [\n [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n ],\n ],\n ];\n }\n\n private function getAssociatedObjectFilter(string $objectType, string $objectId): array\n {\n return [\n 'propertyName' => 'associations.' . $objectType,\n 'operator' => 'EQ',\n 'value' => $objectId,\n ];\n }\n\n public function generatePlaybackURLSearchPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $activityProvider,\n ],\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $this->getSearchCallAttributes(),\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function getSearchCallAttributes(): array\n {\n return [\n 'hs_timestamp',\n 'hs_call_recording_url',\n 'hs_call_body',\n 'hs_call_status',\n 'hs_call_to_number',\n 'hs_call_from_number',\n 'hs_call_duration',\n 'hs_call_disposition',\n 'hs_call_title',\n 'hs_call_direction',\n 'hubspot_owner_id',\n 'hs_activity_type',\n 'hs_call_external_id',\n 'hs_call_source',\n ];\n }\n\n public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array\n {\n $updateObjectsData = [];\n\n foreach ($crmUpdateData as $data) {\n $updateObjectsData[] = [\n 'id' => $data['crm_id'],\n 'properties' => [\n 'hs_call_body' => $data['hs_call_body'] .\n '<p><span style=\"font-size: 13.3333px; line-height: 16px;\">' .\n '<a href=\"' . $data['playback_url'] . '\" target=\"_blank\">Review in Jiminny</a> ▶️</span></p>',\n ],\n ];\n }\n\n return ['inputs' => $updateObjectsData];\n }\n\n public function generateSearchCallByTokenPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload for phone search based on the specified parameters.\n *\n * @param string $phone The phone number to search.\n * @param bool $isAlternativeSearch Indicates if an alternative search should be performed\n * if the first search fails to find a match. The first search request should cover most of the cases.\n */\n public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array\n {\n $filterPropertyNames = $isAlternativeSearch ?\n ['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :\n ['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];\n\n $filterGroups = array_map(function ($propertyName) use ($phone) {\n return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);\n }, $filterPropertyNames);\n\n $properties = [\n 'email',\n 'firstname',\n 'lastname',\n 'country',\n 'phone',\n 'mobilephone',\n 'jobtitle',\n 'hubspot_owner_id',\n 'associatedcompanyid',\n 'photo',\n ];\n\n return $this->createPayload($filterGroups, $properties);\n }\n\n /**\n * Creates a filter group with the specified parameters.\n */\n private function createFilterGroup(string $propertyName, string $operator, $value): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => $propertyName,\n 'operator' => $operator,\n 'value' => $value,\n ],\n ],\n ];\n }\n\n /**\n * Creates a payload with the specified filter groups and properties.\n */\n private function createPayload(array $filterGroups, array $properties): array\n {\n return [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => 'modifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $properties,\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload to find related activities based on the specified data and object type.\n * The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)\n * and are associated with any of the provided prospect types (contact or company).\n *\n * @param array $data An associative array containing the following keys:\n * - 'from': The start time for the activity search (timestamp).\n * - 'to': The end time for the activity search (timestamp).\n * - 'contact': (optional) The ID of the associated contact.\n * - 'company': (optional) The ID of the associated company.\n * @param string $objectType The type of engagement to search for (meeting or other type like call).\n *\n * @return array The payload array to be used for searching related activities.\n */\n public function getFindRelatedActivityPayload(array $data, string $objectType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($objectType === self::ENGAGEMENT_MEETINGS) {\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_activity_type',\n 'hs_timestamp',\n 'hubspot_owner_id',\n 'hs_meeting_body',\n 'hs_internal_meeting_notes',\n 'hs_meeting_location',\n 'hs_meeting_start_time',\n 'hs_meeting_end_time',\n ];\n } else {\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];\n }\n\n $timeFiltersWithEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'LTE',\n 'value' => $data['to'],\n ],\n ];\n\n $timeFiltersWithoutEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ];\n\n $payload['filterGroups'] = [];\n\n $associationTypes = ['contact', 'company'];\n foreach ($associationTypes as $type) {\n if (! empty($data[$type])) {\n $filterGroupWithEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithEndTime;\n\n $filterGroupWithoutEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithoutEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithoutEndTime ;\n }\n }\n\n return $payload;\n }\n\n /** Parameters\n * [\n * 'accountId' => $crmAccountId,\n * 'sortBy' => $sortBy,\n * 'sortDir' => $sortDir,\n * 'onlyOpen' => $onlyOpen,\n * 'closedStages' => $this->getClosedDealStages(),\n * 'userId' => $userId,\n * ];\n */\n public function generateOpportunitiesSearchPayload(\n Configuration $config,\n string $crmAccountId,\n array $closedStages,\n ): array {\n $closedFilters = [];\n $filterGroups = [];\n $onlyOpen = true;\n\n switch ($config->getOpportunityAssignmentRule()) {\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'ASCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:\n default:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n $onlyOpen = false;\n }\n\n $baseFilters = [\n [\n 'propertyName' => 'associations.company',\n 'operator' => 'EQ',\n 'value' => $crmAccountId,\n ],\n ];\n\n // Handle closed stages in chunks\n if ($onlyOpen) {\n foreach (['won', 'lost'] as $key) {\n if (! empty($closedStages[$key])) {\n $chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);\n foreach ($chunks as $chunk) {\n $closedFilters[] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $chunk,\n ];\n }\n }\n }\n }\n\n $filterGroups[] = [\n 'filters' => array_merge($baseFilters, $closedFilters),\n ];\n\n $payload = [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => $sortBy,\n 'direction' => $sortDir,\n ],\n ],\n 'properties' => [\n 'dealname',\n 'amount',\n 'hubspot_owner_id',\n 'pipeline',\n 'dealstage',\n 'closedate',\n 'deal_currency_code',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n $logger = app(LoggerInterface::class);\n $logger->info('[HubSpot] CRM Search requested', [\n 'request' => $payload,\n ]);\n\n return $payload;\n }\n\n /**\n * Converts v1 payload data to v3\n */\n public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array\n {\n // Use this mapping until the whole Hubspot V1 is dropped.\n $properties = [\n 'hubspot_owner_id' => $engagement['ownerId'],\n 'hs_timestamp' => $engagement['timestamp'],\n ];\n\n // $engagement['activityType'] is $activity->category->name\n if (isset($engagement['activityType'])) {\n $properties['hs_activity_type'] = $engagement['activityType'];\n }\n\n $metadataKeyMap = [\n 'hs_meeting_outcome' => 'meetingOutcome',\n 'hs_meeting_title' => 'title',\n 'hs_meeting_start_time' => 'startTime',\n 'hs_meeting_end_time' => 'endTime',\n 'hs_meeting_body' => 'body',\n 'hs_internal_meeting_notes' => 'internalMeetingNotes',\n ];\n\n foreach ($metadataKeyMap as $newKey => $oldKey) {\n if (isset($metadata[$oldKey])) {\n $properties[$newKey] = $metadata[$oldKey];\n unset($metadata[$oldKey]);\n }\n }\n\n $properties = [\n ...$properties,\n ...$metadata, // custom fields\n ];\n\n $response = [\n 'properties' => $properties,\n ];\n\n if (! empty($associations)) {\n $response['associations'] = $associations;\n }\n\n return $response;\n }\n\n /**\n * Generate a payload to search for contacts by name.\n * The search is a token search in firstname or lastname\n */\n public function generateSearchContactsByNamePayload(string $name, array $fields): array\n {\n $firstNameFilter = [\n 'propertyName' => 'firstname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n $lastNameFilter = [\n 'propertyName' => 'lastname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n return [\n 'filterGroups' => [\n [\n 'filters' => [$firstNameFilter],\n ],\n [\n 'filters' => [$lastNameFilter],\n ],\n ],\n 'properties' => $fields,\n 'sorts' => [\n [\n 'propertyName' => 'lastmodifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n ];\n }\n\n public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array\n {\n $inputs = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $inputs[] = [\n 'from' => [\n 'id' => $crmId,\n ],\n 'to' => [\n 'id' => (string) $id,\n ],\n 'types' => [\n [\n 'associationCategory' => 'HUBSPOT_DEFINED',\n 'associationTypeId' => $associationType,\n ],\n ],\n ];\n }\n\n return ['inputs' => $inputs];\n }\n\n public function buildRemoveAssociationPayload(string $crmId, array $ids): array\n {\n $toArray = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $toArray[] = ['id' => (string) $id];\n }\n\n return [\n 'inputs' => [\n [\n 'from' => ['id' => $crmId],\n 'to' => $toArray,\n ],\n ],\n ];\n }\n\n public function addClosedStageFilters(array &$payload, array $closedStages): void\n {\n if (! empty($closedStages['won'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['won'],\n ];\n }\n\n if (! empty($closedStages['lost'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['lost'],\n ];\n }\n }\n\n public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void\n {\n $payload['filters'][] = [\n 'propertyName' => 'createdate',\n 'operator' => 'GT',\n 'value' => $createdAfter->getPreciseTimestamp(3),\n ];\n }\n\n public function getDealsInBulkPayload(array $dealIds): array\n {\n return [\n 'filterGroups' => [\n [\n 'filters' => [\n [\n 'propertyName' => 'hs_object_id',\n 'operator' => 'IN',\n 'values' => $dealIds,\n ],\n ],\n ],\n ],\n 'limit' => self::MAX_FILTER_SIZE,\n ];\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Psr\\Log\\LoggerInterface;\n\nclass PayloadBuilder\n{\n public const int MAX_SEARCH_REQUEST_LIMIT = 200;\n\n private const int MAX_FILTER_SIZE = 100;\n\n private const string SORT_PROPERTY = 'hs_timestamp';\n private const string ENGAGEMENT_MEETINGS = 'meetings';\n\n public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($engagementType === self::ENGAGEMENT_MEETINGS) {\n $payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_timestamp',\n 'hs_activity_type',\n ];\n } else {\n $payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp'];\n }\n\n return $payload;\n }\n\n public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array\n {\n $lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array\n {\n $lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n [\n 'propertyName' => 'hubspot_owner_id',\n 'operator' => 'EQ',\n 'value' => $crmId,\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array\n {\n $filters = [];\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'IN',\n 'values' => ['SCHEDULED', 'RESCHEDULED'],\n ],\n ],\n ];\n\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ],\n ];\n\n return $filters;\n }\n\n private function buildTaskFiltersForLinkToTask($objectType, $objectId): array\n {\n return [\n [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n ],\n ],\n ];\n }\n\n private function getAssociatedObjectFilter(string $objectType, string $objectId): array\n {\n return [\n 'propertyName' => 'associations.' . $objectType,\n 'operator' => 'EQ',\n 'value' => $objectId,\n ];\n }\n\n public function generatePlaybackURLSearchPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $activityProvider,\n ],\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $this->getSearchCallAttributes(),\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function getSearchCallAttributes(): array\n {\n return [\n 'hs_timestamp',\n 'hs_call_recording_url',\n 'hs_call_body',\n 'hs_call_status',\n 'hs_call_to_number',\n 'hs_call_from_number',\n 'hs_call_duration',\n 'hs_call_disposition',\n 'hs_call_title',\n 'hs_call_direction',\n 'hubspot_owner_id',\n 'hs_activity_type',\n 'hs_call_external_id',\n 'hs_call_source',\n ];\n }\n\n public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array\n {\n $updateObjectsData = [];\n\n foreach ($crmUpdateData as $data) {\n $updateObjectsData[] = [\n 'id' => $data['crm_id'],\n 'properties' => [\n 'hs_call_body' => $data['hs_call_body'] .\n '<p><span style=\"font-size: 13.3333px; line-height: 16px;\">' .\n '<a href=\"' . $data['playback_url'] . '\" target=\"_blank\">Review in Jiminny</a> ▶️</span></p>',\n ],\n ];\n }\n\n return ['inputs' => $updateObjectsData];\n }\n\n public function generateSearchCallByTokenPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload for phone search based on the specified parameters.\n *\n * @param string $phone The phone number to search.\n * @param bool $isAlternativeSearch Indicates if an alternative search should be performed\n * if the first search fails to find a match. The first search request should cover most of the cases.\n */\n public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array\n {\n $filterPropertyNames = $isAlternativeSearch ?\n ['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :\n ['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];\n\n $filterGroups = array_map(function ($propertyName) use ($phone) {\n return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);\n }, $filterPropertyNames);\n\n $properties = [\n 'email',\n 'firstname',\n 'lastname',\n 'country',\n 'phone',\n 'mobilephone',\n 'jobtitle',\n 'hubspot_owner_id',\n 'associatedcompanyid',\n 'photo',\n ];\n\n return $this->createPayload($filterGroups, $properties);\n }\n\n /**\n * Creates a filter group with the specified parameters.\n */\n private function createFilterGroup(string $propertyName, string $operator, $value): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => $propertyName,\n 'operator' => $operator,\n 'value' => $value,\n ],\n ],\n ];\n }\n\n /**\n * Creates a payload with the specified filter groups and properties.\n */\n private function createPayload(array $filterGroups, array $properties): array\n {\n return [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => 'modifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $properties,\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload to find related activities based on the specified data and object type.\n * The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)\n * and are associated with any of the provided prospect types (contact or company).\n *\n * @param array $data An associative array containing the following keys:\n * - 'from': The start time for the activity search (timestamp).\n * - 'to': The end time for the activity search (timestamp).\n * - 'contact': (optional) The ID of the associated contact.\n * - 'company': (optional) The ID of the associated company.\n * @param string $objectType The type of engagement to search for (meeting or other type like call).\n *\n * @return array The payload array to be used for searching related activities.\n */\n public function getFindRelatedActivityPayload(array $data, string $objectType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($objectType === self::ENGAGEMENT_MEETINGS) {\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_activity_type',\n 'hs_timestamp',\n 'hubspot_owner_id',\n 'hs_meeting_body',\n 'hs_internal_meeting_notes',\n 'hs_meeting_location',\n 'hs_meeting_start_time',\n 'hs_meeting_end_time',\n ];\n } else {\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];\n }\n\n $timeFiltersWithEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'LTE',\n 'value' => $data['to'],\n ],\n ];\n\n $timeFiltersWithoutEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ];\n\n $payload['filterGroups'] = [];\n\n $associationTypes = ['contact', 'company'];\n foreach ($associationTypes as $type) {\n if (! empty($data[$type])) {\n $filterGroupWithEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithEndTime;\n\n $filterGroupWithoutEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithoutEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithoutEndTime ;\n }\n }\n\n return $payload;\n }\n\n /** Parameters\n * [\n * 'accountId' => $crmAccountId,\n * 'sortBy' => $sortBy,\n * 'sortDir' => $sortDir,\n * 'onlyOpen' => $onlyOpen,\n * 'closedStages' => $this->getClosedDealStages(),\n * 'userId' => $userId,\n * ];\n */\n public function generateOpportunitiesSearchPayload(\n Configuration $config,\n string $crmAccountId,\n array $closedStages,\n ): array {\n $closedFilters = [];\n $filterGroups = [];\n $onlyOpen = true;\n\n switch ($config->getOpportunityAssignmentRule()) {\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'ASCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:\n default:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n $onlyOpen = false;\n }\n\n $baseFilters = [\n [\n 'propertyName' => 'associations.company',\n 'operator' => 'EQ',\n 'value' => $crmAccountId,\n ],\n ];\n\n // Handle closed stages in chunks\n if ($onlyOpen) {\n foreach (['won', 'lost'] as $key) {\n if (! empty($closedStages[$key])) {\n $chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);\n foreach ($chunks as $chunk) {\n $closedFilters[] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $chunk,\n ];\n }\n }\n }\n }\n\n $filterGroups[] = [\n 'filters' => array_merge($baseFilters, $closedFilters),\n ];\n\n $payload = [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => $sortBy,\n 'direction' => $sortDir,\n ],\n ],\n 'properties' => [\n 'dealname',\n 'amount',\n 'hubspot_owner_id',\n 'pipeline',\n 'dealstage',\n 'closedate',\n 'deal_currency_code',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n $logger = app(LoggerInterface::class);\n $logger->info('[HubSpot] CRM Search requested', [\n 'request' => $payload,\n ]);\n\n return $payload;\n }\n\n /**\n * Converts v1 payload data to v3\n */\n public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array\n {\n // Use this mapping until the whole Hubspot V1 is dropped.\n $properties = [\n 'hubspot_owner_id' => $engagement['ownerId'],\n 'hs_timestamp' => $engagement['timestamp'],\n ];\n\n // $engagement['activityType'] is $activity->category->name\n if (isset($engagement['activityType'])) {\n $properties['hs_activity_type'] = $engagement['activityType'];\n }\n\n $metadataKeyMap = [\n 'hs_meeting_outcome' => 'meetingOutcome',\n 'hs_meeting_title' => 'title',\n 'hs_meeting_start_time' => 'startTime',\n 'hs_meeting_end_time' => 'endTime',\n 'hs_meeting_body' => 'body',\n 'hs_internal_meeting_notes' => 'internalMeetingNotes',\n ];\n\n foreach ($metadataKeyMap as $newKey => $oldKey) {\n if (isset($metadata[$oldKey])) {\n $properties[$newKey] = $metadata[$oldKey];\n unset($metadata[$oldKey]);\n }\n }\n\n $properties = [\n ...$properties,\n ...$metadata, // custom fields\n ];\n\n $response = [\n 'properties' => $properties,\n ];\n\n if (! empty($associations)) {\n $response['associations'] = $associations;\n }\n\n return $response;\n }\n\n /**\n * Generate a payload to search for contacts by name.\n * The search is a token search in firstname or lastname\n */\n public function generateSearchContactsByNamePayload(string $name, array $fields): array\n {\n $firstNameFilter = [\n 'propertyName' => 'firstname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n $lastNameFilter = [\n 'propertyName' => 'lastname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n return [\n 'filterGroups' => [\n [\n 'filters' => [$firstNameFilter],\n ],\n [\n 'filters' => [$lastNameFilter],\n ],\n ],\n 'properties' => $fields,\n 'sorts' => [\n [\n 'propertyName' => 'lastmodifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n ];\n }\n\n public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array\n {\n $inputs = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $inputs[] = [\n 'from' => [\n 'id' => $crmId,\n ],\n 'to' => [\n 'id' => (string) $id,\n ],\n 'types' => [\n [\n 'associationCategory' => 'HUBSPOT_DEFINED',\n 'associationTypeId' => $associationType,\n ],\n ],\n ];\n }\n\n return ['inputs' => $inputs];\n }\n\n public function buildRemoveAssociationPayload(string $crmId, array $ids): array\n {\n $toArray = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $toArray[] = ['id' => (string) $id];\n }\n\n return [\n 'inputs' => [\n [\n 'from' => ['id' => $crmId],\n 'to' => $toArray,\n ],\n ],\n ];\n }\n\n public function addClosedStageFilters(array &$payload, array $closedStages): void\n {\n if (! empty($closedStages['won'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['won'],\n ];\n }\n\n if (! empty($closedStages['lost'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['lost'],\n ];\n }\n }\n\n public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void\n {\n $payload['filters'][] = [\n 'propertyName' => 'createdate',\n 'operator' => 'GT',\n 'value' => $createdAfter->getPreciseTimestamp(3),\n ];\n }\n\n public function getDealsInBulkPayload(array $dealIds): array\n {\n return [\n 'filterGroups' => [\n [\n 'filters' => [\n [\n 'propertyName' => 'hs_object_id',\n 'operator' => 'IN',\n 'values' => $dealIds,\n ],\n ],\n ],\n ],\n 'limit' => self::MAX_FILTER_SIZE,\n ];\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9078253235426753618
|
1349767247385803396
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
25
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use Carbon\Carbon;
use Jiminny\Models\Crm\Configuration;
use Psr\Log\LoggerInterface;
class PayloadBuilder
{
public const int MAX_SEARCH_REQUEST_LIMIT = 200;
private const int MAX_FILTER_SIZE = 100;
private const string SORT_PROPERTY = 'hs_timestamp';
private const string ENGAGEMENT_MEETINGS = 'meetings';
public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($engagementType === self::ENGAGEMENT_MEETINGS) {
$payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_timestamp',
'hs_activity_type',
];
} else {
$payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = ['hs_task_subject', 'hs_timestamp'];
}
return $payload;
}
public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array
{
$lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array
{
$lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
[
'propertyName' => 'hubspot_owner_id',
'operator' => 'EQ',
'value' => $crmId,
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array
{
$filters = [];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'IN',
'values' => ['SCHEDULED', 'RESCHEDULED'],
],
],
];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'NOT_HAS_PROPERTY',
],
],
];
return $filters;
}
private function buildTaskFiltersForLinkToTask($objectType, $objectId): array
{
return [
[
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
],
],
];
}
private function getAssociatedObjectFilter(string $objectType, string $objectId): array
{
return [
'propertyName' => 'associations.' . $objectType,
'operator' => 'EQ',
'value' => $objectId,
];
}
public function generatePlaybackURLSearchPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $activityProvider,
],
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => $this->getSearchCallAttributes(),
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function getSearchCallAttributes(): array
{
return [
'hs_timestamp',
'hs_call_recording_url',
'hs_call_body',
'hs_call_status',
'hs_call_to_number',
'hs_call_from_number',
'hs_call_duration',
'hs_call_disposition',
'hs_call_title',
'hs_call_direction',
'hubspot_owner_id',
'hs_activity_type',
'hs_call_external_id',
'hs_call_source',
];
}
public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array
{
$updateObjectsData = [];
foreach ($crmUpdateData as $data) {
$updateObjectsData[] = [
'id' => $data['crm_id'],
'properties' => [
'hs_call_body' => $data['hs_call_body'] .
'<p><span style="font-size: 13.3333px; line-height: 16px;">' .
'<a href="' . $data['playback_url'] . '" target="_blank">Review in Jiminny</a> ▶️</span></p>',
],
];
}
return ['inputs' => $updateObjectsData];
}
public function generateSearchCallByTokenPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
/**
* Generates a payload for phone search based on the specified parameters.
*
* @param string $phone The phone number to search.
* @param bool $isAlternativeSearch Indicates if an alternative search should be performed
* if the first search fails to find a match. The first search request should cover most of the cases.
*/
public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array
{
$filterPropertyNames = $isAlternativeSearch ?
['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :
['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];
$filterGroups = array_map(function ($propertyName) use ($phone) {
return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);
}, $filterPropertyNames);
$properties = [
'email',
'firstname',
'lastname',
'country',
'phone',
'mobilephone',
'jobtitle',
'hubspot_owner_id',
'associatedcompanyid',
'photo',
];
return $this->createPayload($filterGroups, $properties);
}
/**
* Creates a filter group with the specified parameters.
*/
private function createFilterGroup(string $propertyName, string $operator, $value): array
{
return [
'filters' => [
[
'propertyName' => $propertyName,
'operator' => $operator,
'value' => $value,
],
],
];
}
/**
* Creates a payload with the specified filter groups and properties.
*/
private function createPayload(array $filterGroups, array $properties): array
{
return [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => 'modifieddate',
'direction' => 'DESCENDING',
],
],
'properties' => $properties,
'limit' => 1,
];
}
/**
* Generates a payload to find related activities based on the specified data and object type.
* The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)
* and are associated with any of the provided prospect types (contact or company).
*
* @param array $data An associative array containing the following keys:
* - 'from': The start time for the activity search (timestamp).
* - 'to': The end time for the activity search (timestamp).
* - 'contact': (optional) The ID of the associated contact.
* - 'company': (optional) The ID of the associated company.
* @param string $objectType The type of engagement to search for (meeting or other type like call).
*
* @return array The payload array to be used for searching related activities.
*/
public function getFindRelatedActivityPayload(array $data, string $objectType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($objectType === self::ENGAGEMENT_MEETINGS) {
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_activity_type',
'hs_timestamp',
'hubspot_owner_id',
'hs_meeting_body',
'hs_internal_meeting_notes',
'hs_meeting_location',
'hs_meeting_start_time',
'hs_meeting_end_time',
];
} else {
$payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];
}
$timeFiltersWithEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'LTE',
'value' => $data['to'],
],
];
$timeFiltersWithoutEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'NOT_HAS_PROPERTY',
],
];
$payload['filterGroups'] = [];
$associationTypes = ['contact', 'company'];
foreach ($associationTypes as $type) {
if (! empty($data[$type])) {
$filterGroupWithEndTime = [
'filters' => array_merge(
$timeFiltersWithEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithEndTime;
$filterGroupWithoutEndTime = [
'filters' => array_merge(
$timeFiltersWithoutEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithoutEndTime ;
}
}
return $payload;
}
/** Parameters
* [
* 'accountId' => $crmAccountId,
* 'sortBy' => $sortBy,
* 'sortDir' => $sortDir,
* 'onlyOpen' => $onlyOpen,
* 'closedStages' => $this->getClosedDealStages(),
* 'userId' => $userId,
* ];
*/
public function generateOpportunitiesSearchPayload(
Configuration $config,
string $crmAccountId,
array $closedStages,
): array {
$closedFilters = [];
$filterGroups = [];
$onlyOpen = true;
switch ($config->getOpportunityAssignmentRule()) {
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:
$sortBy = 'createdate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:
$sortBy = 'createdate';
$sortDir = 'ASCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:
default:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
$onlyOpen = false;
}
$baseFilters = [
[
'propertyName' => 'associations.company',
'operator' => 'EQ',
'value' => $crmAccountId,
],
];
// Handle closed stages in chunks
if ($onlyOpen) {
foreach (['won', 'lost'] as $key) {
if (! empty($closedStages[$key])) {
$chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);
foreach ($chunks as $chunk) {
$closedFilters[] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $chunk,
];
}
}
}
}
$filterGroups[] = [
'filters' => array_merge($baseFilters, $closedFilters),
];
$payload = [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => $sortBy,
'direction' => $sortDir,
],
],
'properties' => [
'dealname',
'amount',
'hubspot_owner_id',
'pipeline',
'dealstage',
'closedate',
'deal_currency_code',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
$logger = app(LoggerInterface::class);
$logger->info('[HubSpot] CRM Search requested', [
'request' => $payload,
]);
return $payload;
}
/**
* Converts v1 payload data to v3
*/
public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array
{
// Use this mapping until the whole Hubspot V1 is dropped.
$properties = [
'hubspot_owner_id' => $engagement['ownerId'],
'hs_timestamp' => $engagement['timestamp'],
];
// $engagement['activityType'] is $activity->category->name
if (isset($engagement['activityType'])) {
$properties['hs_activity_type'] = $engagement['activityType'];
}
$metadataKeyMap = [
'hs_meeting_outcome' => 'meetingOutcome',
'hs_meeting_title' => 'title',
'hs_meeting_start_time' => 'startTime',
'hs_meeting_end_time' => 'endTime',
'hs_meeting_body' => 'body',
'hs_internal_meeting_notes' => 'internalMeetingNotes',
];
foreach ($metadataKeyMap as $newKey => $oldKey) {
if (isset($metadata[$oldKey])) {
$properties[$newKey] = $metadata[$oldKey];
unset($metadata[$oldKey]);
}
}
$properties = [
...$properties,
...$metadata, // custom fields
];
$response = [
'properties' => $properties,
];
if (! empty($associations)) {
$response['associations'] = $associations;
}
return $response;
}
/**
* Generate a payload to search for contacts by name.
* The search is a token search in firstname or lastname
*/
public function generateSearchContactsByNamePayload(string $name, array $fields): array
{
$firstNameFilter = [
'propertyName' => 'firstname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
$lastNameFilter = [
'propertyName' => 'lastname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
return [
'filterGroups' => [
[
'filters' => [$firstNameFilter],
],
[
'filters' => [$lastNameFilter],
],
],
'properties' => $fields,
'sorts' => [
[
'propertyName' => 'lastmodifieddate',
'direction' => 'DESCENDING',
],
],
];
}
public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array
{
$inputs = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$inputs[] = [
'from' => [
'id' => $crmId,
],
'to' => [
'id' => (string) $id,
],
'types' => [
[
'associationCategory' => 'HUBSPOT_DEFINED',
'associationTypeId' => $associationType,
],
],
];
}
return ['inputs' => $inputs];
}
public function buildRemoveAssociationPayload(string $crmId, array $ids): array
{
$toArray = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$toArray[] = ['id' => (string) $id];
}
return [
'inputs' => [
[
'from' => ['id' => $crmId],
'to' => $toArray,
],
],
];
}
public function addClosedStageFilters(array &$payload, array $closedStages): void
{
if (! empty($closedStages['won'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['won'],
];
}
if (! empty($closedStages['lost'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['lost'],
];
}
}
public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void
{
$payload['filters'][] = [
'propertyName' => 'createdate',
'operator' => 'GT',
'value' => $createdAfter->getPreciseTimestamp(3),
];
}
public function getDealsInBulkPayload(array $dealIds): array
{
return [
'filterGroups' => [
[
'filters' => [
[
'propertyName' => 'hs_object_id',
'operator' => 'IN',
'values' => $dealIds,
],
],
],
],
'limit' => self::MAX_FILTER_SIZE,
];
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
40288
|
1488
|
14
|
2026-05-14T08:30:19.705148+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778747419705_m2.jpg...
|
PhpStorm
|
faVsco.js – console [EU]
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
25
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use Carbon\Carbon;
use Jiminny\Models\Crm\Configuration;
use Psr\Log\LoggerInterface;
class PayloadBuilder
{
public const int MAX_SEARCH_REQUEST_LIMIT = 200;
private const int MAX_FILTER_SIZE = 100;
private const string SORT_PROPERTY = 'hs_timestamp';
private const string ENGAGEMENT_MEETINGS = 'meetings';
public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($engagementType === self::ENGAGEMENT_MEETINGS) {
$payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_timestamp',
'hs_activity_type',
];
} else {
$payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = ['hs_task_subject', 'hs_timestamp'];
}
return $payload;
}
public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array
{
$lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array
{
$lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
[
'propertyName' => 'hubspot_owner_id',
'operator' => 'EQ',
'value' => $crmId,
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array
{
$filters = [];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'IN',
'values' => ['SCHEDULED', 'RESCHEDULED'],
],
],
];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'NOT_HAS_PROPERTY',
],
],
];
return $filters;
}
private function buildTaskFiltersForLinkToTask($objectType, $objectId): array
{
return [
[
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
],
],
];
}
private function getAssociatedObjectFilter(string $objectType, string $objectId): array
{
return [
'propertyName' => 'associations.' . $objectType,
'operator' => 'EQ',
'value' => $objectId,
];
}
public function generatePlaybackURLSearchPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $activityProvider,
],
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => $this->getSearchCallAttributes(),
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function getSearchCallAttributes(): array
{
return [
'hs_timestamp',
'hs_call_recording_url',
'hs_call_body',
'hs_call_status',
'hs_call_to_number',
'hs_call_from_number',
'hs_call_duration',
'hs_call_disposition',
'hs_call_title',
'hs_call_direction',
'hubspot_owner_id',
'hs_activity_type',
'hs_call_external_id',
'hs_call_source',
];
}
public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array
{
$updateObjectsData = [];
foreach ($crmUpdateData as $data) {
$updateObjectsData[] = [
'id' => $data['crm_id'],
'properties' => [
'hs_call_body' => $data['hs_call_body'] .
'<p><span style="font-size: 13.3333px; line-height: 16px;">' .
'<a href="' . $data['playback_url'] . '" target="_blank">Review in Jiminny</a> ▶️</span></p>',
],
];
}
return ['inputs' => $updateObjectsData];
}
public function generateSearchCallByTokenPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
/**
* Generates a payload for phone search based on the specified parameters.
*
* @param string $phone The phone number to search.
* @param bool $isAlternativeSearch Indicates if an alternative search should be performed
* if the first search fails to find a match. The first search request should cover most of the cases.
*/
public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array
{
$filterPropertyNames = $isAlternativeSearch ?
['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :
['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];
$filterGroups = array_map(function ($propertyName) use ($phone) {
return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);
}, $filterPropertyNames);
$properties = [
'email',
'firstname',
'lastname',
'country',
'phone',
'mobilephone',
'jobtitle',
'hubspot_owner_id',
'associatedcompanyid',
'photo',
];
return $this->createPayload($filterGroups, $properties);
}
/**
* Creates a filter group with the specified parameters.
*/
private function createFilterGroup(string $propertyName, string $operator, $value): array
{
return [
'filters' => [
[
'propertyName' => $propertyName,
'operator' => $operator,
'value' => $value,
],
],
];
}
/**
* Creates a payload with the specified filter groups and properties.
*/
private function createPayload(array $filterGroups, array $properties): array
{
return [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => 'modifieddate',
'direction' => 'DESCENDING',
],
],
'properties' => $properties,
'limit' => 1,
];
}
/**
* Generates a payload to find related activities based on the specified data and object type.
* The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)
* and are associated with any of the provided prospect types (contact or company).
*
* @param array $data An associative array containing the following keys:
* - 'from': The start time for the activity search (timestamp).
* - 'to': The end time for the activity search (timestamp).
* - 'contact': (optional) The ID of the associated contact.
* - 'company': (optional) The ID of the associated company.
* @param string $objectType The type of engagement to search for (meeting or other type like call).
*
* @return array The payload array to be used for searching related activities.
*/
public function getFindRelatedActivityPayload(array $data, string $objectType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($objectType === self::ENGAGEMENT_MEETINGS) {
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_activity_type',
'hs_timestamp',
'hubspot_owner_id',
'hs_meeting_body',
'hs_internal_meeting_notes',
'hs_meeting_location',
'hs_meeting_start_time',
'hs_meeting_end_time',
];
} else {
$payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];
}
$timeFiltersWithEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'LTE',
'value' => $data['to'],
],
];
$timeFiltersWithoutEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'NOT_HAS_PROPERTY',
],
];
$payload['filterGroups'] = [];
$associationTypes = ['contact', 'company'];
foreach ($associationTypes as $type) {
if (! empty($data[$type])) {
$filterGroupWithEndTime = [
'filters' => array_merge(
$timeFiltersWithEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithEndTime;
$filterGroupWithoutEndTime = [
'filters' => array_merge(
$timeFiltersWithoutEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithoutEndTime ;
}
}
return $payload;
}
/** Parameters
* [
* 'accountId' => $crmAccountId,
* 'sortBy' => $sortBy,
* 'sortDir' => $sortDir,
* 'onlyOpen' => $onlyOpen,
* 'closedStages' => $this->getClosedDealStages(),
* 'userId' => $userId,
* ];
*/
public function generateOpportunitiesSearchPayload(
Configuration $config,
string $crmAccountId,
array $closedStages,
): array {
$closedFilters = [];
$filterGroups = [];
$onlyOpen = true;
switch ($config->getOpportunityAssignmentRule()) {
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:
$sortBy = 'createdate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:
$sortBy = 'createdate';
$sortDir = 'ASCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:
default:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
$onlyOpen = false;
}
$baseFilters = [
[
'propertyName' => 'associations.company',
'operator' => 'EQ',
'value' => $crmAccountId,
],
];
// Handle closed stages in chunks
if ($onlyOpen) {
foreach (['won', 'lost'] as $key) {
if (! empty($closedStages[$key])) {
$chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);
foreach ($chunks as $chunk) {
$closedFilters[] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $chunk,
];
}
}
}
}
$filterGroups[] = [
'filters' => array_merge($baseFilters, $closedFilters),
];
$payload = [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => $sortBy,
'direction' => $sortDir,
],
],
'properties' => [
'dealname',
'amount',
'hubspot_owner_id',
'pipeline',
'dealstage',
'closedate',
'deal_currency_code',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
$logger = app(LoggerInterface::class);
$logger->info('[HubSpot] CRM Search requested', [
'request' => $payload,
]);
return $payload;
}
/**
* Converts v1 payload data to v3
*/
public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array
{
// Use this mapping until the whole Hubspot V1 is dropped.
$properties = [
'hubspot_owner_id' => $engagement['ownerId'],
'hs_timestamp' => $engagement['timestamp'],
];
// $engagement['activityType'] is $activity->category->name
if (isset($engagement['activityType'])) {
$properties['hs_activity_type'] = $engagement['activityType'];
}
$metadataKeyMap = [
'hs_meeting_outcome' => 'meetingOutcome',
'hs_meeting_title' => 'title',
'hs_meeting_start_time' => 'startTime',
'hs_meeting_end_time' => 'endTime',
'hs_meeting_body' => 'body',
'hs_internal_meeting_notes' => 'internalMeetingNotes',
];
foreach ($metadataKeyMap as $newKey => $oldKey) {
if (isset($metadata[$oldKey])) {
$properties[$newKey] = $metadata[$oldKey];
unset($metadata[$oldKey]);
}
}
$properties = [
...$properties,
...$metadata, // custom fields
];
$response = [
'properties' => $properties,
];
if (! empty($associations)) {
$response['associations'] = $associations;
}
return $response;
}
/**
* Generate a payload to search for contacts by name.
* The search is a token search in firstname or lastname
*/
public function generateSearchContactsByNamePayload(string $name, array $fields): array
{
$firstNameFilter = [
'propertyName' => 'firstname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
$lastNameFilter = [
'propertyName' => 'lastname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
return [
'filterGroups' => [
[
'filters' => [$firstNameFilter],
],
[
'filters' => [$lastNameFilter],
],
],
'properties' => $fields,
'sorts' => [
[
'propertyName' => 'lastmodifieddate',
'direction' => 'DESCENDING',
],
],
];
}
public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array
{
$inputs = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$inputs[] = [
'from' => [
'id' => $crmId,
],
'to' => [
'id' => (string) $id,
],
'types' => [
[
'associationCategory' => 'HUBSPOT_DEFINED',
'associationTypeId' => $associationType,
],
],
];
}
return ['inputs' => $inputs];
}
public function buildRemoveAssociationPayload(string $crmId, array $ids): array
{
$toArray = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$toArray[] = ['id' => (string) $id];
}
return [
'inputs' => [
[
'from' => ['id' => $crmId],
'to' => $toArray,
],
],
];
}
public function addClosedStageFilters(array &$payload, array $closedStages): void
{
if (! empty($closedStages['won'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['won'],
];
}
if (! empty($closedStages['lost'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['lost'],
];
}
}
public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void
{
$payload['filters'][] = [
'propertyName' => 'createdate',
'operator' => 'GT',
'value' => $createdAfter->getPreciseTimestamp(3),
];
}
public function getDealsInBulkPayload(array $dealIds): array
{
return [
'filterGroups' => [
[
'filters' => [
[
'propertyName' => 'hs_object_id',
'operator' => 'IN',
'values' => $dealIds,
],
],
],
],
'limit' => self::MAX_FILTER_SIZE,
];
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"master, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.040226065,"height":0.025538707},"on_screen":true,"help_text":"Git Branch: master<br/>Some incoming commits are not fetched<br/>","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8081782,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AskJiminnyReportActivityServiceTest","depth":6,"bounds":{"left":0.8234708,"top":0.019952115,"width":0.09208777,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AskJiminnyReportActivityServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.37200797,"top":0.22426178,"width":0.007978723,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"25","depth":4,"bounds":{"left":0.38198137,"top":0.22426178,"width":0.009973404,"height":0.015163607},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.39361703,"top":0.22266561,"width":0.00731383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.40093085,"top":0.22266561,"width":0.006981383,"height":0.018355945},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Psr\\Log\\LoggerInterface;\n\nclass PayloadBuilder\n{\n public const int MAX_SEARCH_REQUEST_LIMIT = 200;\n\n private const int MAX_FILTER_SIZE = 100;\n\n private const string SORT_PROPERTY = 'hs_timestamp';\n private const string ENGAGEMENT_MEETINGS = 'meetings';\n\n public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($engagementType === self::ENGAGEMENT_MEETINGS) {\n $payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_timestamp',\n 'hs_activity_type',\n ];\n } else {\n $payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp'];\n }\n\n return $payload;\n }\n\n public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array\n {\n $lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array\n {\n $lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n [\n 'propertyName' => 'hubspot_owner_id',\n 'operator' => 'EQ',\n 'value' => $crmId,\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array\n {\n $filters = [];\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'IN',\n 'values' => ['SCHEDULED', 'RESCHEDULED'],\n ],\n ],\n ];\n\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ],\n ];\n\n return $filters;\n }\n\n private function buildTaskFiltersForLinkToTask($objectType, $objectId): array\n {\n return [\n [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n ],\n ],\n ];\n }\n\n private function getAssociatedObjectFilter(string $objectType, string $objectId): array\n {\n return [\n 'propertyName' => 'associations.' . $objectType,\n 'operator' => 'EQ',\n 'value' => $objectId,\n ];\n }\n\n public function generatePlaybackURLSearchPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $activityProvider,\n ],\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $this->getSearchCallAttributes(),\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function getSearchCallAttributes(): array\n {\n return [\n 'hs_timestamp',\n 'hs_call_recording_url',\n 'hs_call_body',\n 'hs_call_status',\n 'hs_call_to_number',\n 'hs_call_from_number',\n 'hs_call_duration',\n 'hs_call_disposition',\n 'hs_call_title',\n 'hs_call_direction',\n 'hubspot_owner_id',\n 'hs_activity_type',\n 'hs_call_external_id',\n 'hs_call_source',\n ];\n }\n\n public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array\n {\n $updateObjectsData = [];\n\n foreach ($crmUpdateData as $data) {\n $updateObjectsData[] = [\n 'id' => $data['crm_id'],\n 'properties' => [\n 'hs_call_body' => $data['hs_call_body'] .\n '<p><span style=\"font-size: 13.3333px; line-height: 16px;\">' .\n '<a href=\"' . $data['playback_url'] . '\" target=\"_blank\">Review in Jiminny</a> ▶️</span></p>',\n ],\n ];\n }\n\n return ['inputs' => $updateObjectsData];\n }\n\n public function generateSearchCallByTokenPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload for phone search based on the specified parameters.\n *\n * @param string $phone The phone number to search.\n * @param bool $isAlternativeSearch Indicates if an alternative search should be performed\n * if the first search fails to find a match. The first search request should cover most of the cases.\n */\n public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array\n {\n $filterPropertyNames = $isAlternativeSearch ?\n ['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :\n ['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];\n\n $filterGroups = array_map(function ($propertyName) use ($phone) {\n return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);\n }, $filterPropertyNames);\n\n $properties = [\n 'email',\n 'firstname',\n 'lastname',\n 'country',\n 'phone',\n 'mobilephone',\n 'jobtitle',\n 'hubspot_owner_id',\n 'associatedcompanyid',\n 'photo',\n ];\n\n return $this->createPayload($filterGroups, $properties);\n }\n\n /**\n * Creates a filter group with the specified parameters.\n */\n private function createFilterGroup(string $propertyName, string $operator, $value): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => $propertyName,\n 'operator' => $operator,\n 'value' => $value,\n ],\n ],\n ];\n }\n\n /**\n * Creates a payload with the specified filter groups and properties.\n */\n private function createPayload(array $filterGroups, array $properties): array\n {\n return [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => 'modifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $properties,\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload to find related activities based on the specified data and object type.\n * The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)\n * and are associated with any of the provided prospect types (contact or company).\n *\n * @param array $data An associative array containing the following keys:\n * - 'from': The start time for the activity search (timestamp).\n * - 'to': The end time for the activity search (timestamp).\n * - 'contact': (optional) The ID of the associated contact.\n * - 'company': (optional) The ID of the associated company.\n * @param string $objectType The type of engagement to search for (meeting or other type like call).\n *\n * @return array The payload array to be used for searching related activities.\n */\n public function getFindRelatedActivityPayload(array $data, string $objectType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($objectType === self::ENGAGEMENT_MEETINGS) {\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_activity_type',\n 'hs_timestamp',\n 'hubspot_owner_id',\n 'hs_meeting_body',\n 'hs_internal_meeting_notes',\n 'hs_meeting_location',\n 'hs_meeting_start_time',\n 'hs_meeting_end_time',\n ];\n } else {\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];\n }\n\n $timeFiltersWithEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'LTE',\n 'value' => $data['to'],\n ],\n ];\n\n $timeFiltersWithoutEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ];\n\n $payload['filterGroups'] = [];\n\n $associationTypes = ['contact', 'company'];\n foreach ($associationTypes as $type) {\n if (! empty($data[$type])) {\n $filterGroupWithEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithEndTime;\n\n $filterGroupWithoutEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithoutEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithoutEndTime ;\n }\n }\n\n return $payload;\n }\n\n /** Parameters\n * [\n * 'accountId' => $crmAccountId,\n * 'sortBy' => $sortBy,\n * 'sortDir' => $sortDir,\n * 'onlyOpen' => $onlyOpen,\n * 'closedStages' => $this->getClosedDealStages(),\n * 'userId' => $userId,\n * ];\n */\n public function generateOpportunitiesSearchPayload(\n Configuration $config,\n string $crmAccountId,\n array $closedStages,\n ): array {\n $closedFilters = [];\n $filterGroups = [];\n $onlyOpen = true;\n\n switch ($config->getOpportunityAssignmentRule()) {\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'ASCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:\n default:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n $onlyOpen = false;\n }\n\n $baseFilters = [\n [\n 'propertyName' => 'associations.company',\n 'operator' => 'EQ',\n 'value' => $crmAccountId,\n ],\n ];\n\n // Handle closed stages in chunks\n if ($onlyOpen) {\n foreach (['won', 'lost'] as $key) {\n if (! empty($closedStages[$key])) {\n $chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);\n foreach ($chunks as $chunk) {\n $closedFilters[] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $chunk,\n ];\n }\n }\n }\n }\n\n $filterGroups[] = [\n 'filters' => array_merge($baseFilters, $closedFilters),\n ];\n\n $payload = [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => $sortBy,\n 'direction' => $sortDir,\n ],\n ],\n 'properties' => [\n 'dealname',\n 'amount',\n 'hubspot_owner_id',\n 'pipeline',\n 'dealstage',\n 'closedate',\n 'deal_currency_code',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n $logger = app(LoggerInterface::class);\n $logger->info('[HubSpot] CRM Search requested', [\n 'request' => $payload,\n ]);\n\n return $payload;\n }\n\n /**\n * Converts v1 payload data to v3\n */\n public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array\n {\n // Use this mapping until the whole Hubspot V1 is dropped.\n $properties = [\n 'hubspot_owner_id' => $engagement['ownerId'],\n 'hs_timestamp' => $engagement['timestamp'],\n ];\n\n // $engagement['activityType'] is $activity->category->name\n if (isset($engagement['activityType'])) {\n $properties['hs_activity_type'] = $engagement['activityType'];\n }\n\n $metadataKeyMap = [\n 'hs_meeting_outcome' => 'meetingOutcome',\n 'hs_meeting_title' => 'title',\n 'hs_meeting_start_time' => 'startTime',\n 'hs_meeting_end_time' => 'endTime',\n 'hs_meeting_body' => 'body',\n 'hs_internal_meeting_notes' => 'internalMeetingNotes',\n ];\n\n foreach ($metadataKeyMap as $newKey => $oldKey) {\n if (isset($metadata[$oldKey])) {\n $properties[$newKey] = $metadata[$oldKey];\n unset($metadata[$oldKey]);\n }\n }\n\n $properties = [\n ...$properties,\n ...$metadata, // custom fields\n ];\n\n $response = [\n 'properties' => $properties,\n ];\n\n if (! empty($associations)) {\n $response['associations'] = $associations;\n }\n\n return $response;\n }\n\n /**\n * Generate a payload to search for contacts by name.\n * The search is a token search in firstname or lastname\n */\n public function generateSearchContactsByNamePayload(string $name, array $fields): array\n {\n $firstNameFilter = [\n 'propertyName' => 'firstname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n $lastNameFilter = [\n 'propertyName' => 'lastname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n return [\n 'filterGroups' => [\n [\n 'filters' => [$firstNameFilter],\n ],\n [\n 'filters' => [$lastNameFilter],\n ],\n ],\n 'properties' => $fields,\n 'sorts' => [\n [\n 'propertyName' => 'lastmodifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n ];\n }\n\n public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array\n {\n $inputs = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $inputs[] = [\n 'from' => [\n 'id' => $crmId,\n ],\n 'to' => [\n 'id' => (string) $id,\n ],\n 'types' => [\n [\n 'associationCategory' => 'HUBSPOT_DEFINED',\n 'associationTypeId' => $associationType,\n ],\n ],\n ];\n }\n\n return ['inputs' => $inputs];\n }\n\n public function buildRemoveAssociationPayload(string $crmId, array $ids): array\n {\n $toArray = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $toArray[] = ['id' => (string) $id];\n }\n\n return [\n 'inputs' => [\n [\n 'from' => ['id' => $crmId],\n 'to' => $toArray,\n ],\n ],\n ];\n }\n\n public function addClosedStageFilters(array &$payload, array $closedStages): void\n {\n if (! empty($closedStages['won'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['won'],\n ];\n }\n\n if (! empty($closedStages['lost'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['lost'],\n ];\n }\n }\n\n public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void\n {\n $payload['filters'][] = [\n 'propertyName' => 'createdate',\n 'operator' => 'GT',\n 'value' => $createdAfter->getPreciseTimestamp(3),\n ];\n }\n\n public function getDealsInBulkPayload(array $dealIds): array\n {\n return [\n 'filterGroups' => [\n [\n 'filters' => [\n [\n 'propertyName' => 'hs_object_id',\n 'operator' => 'IN',\n 'values' => $dealIds,\n ],\n ],\n ],\n ],\n 'limit' => self::MAX_FILTER_SIZE,\n ];\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Hubspot;\n\nuse Carbon\\Carbon;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Psr\\Log\\LoggerInterface;\n\nclass PayloadBuilder\n{\n public const int MAX_SEARCH_REQUEST_LIMIT = 200;\n\n private const int MAX_FILTER_SIZE = 100;\n\n private const string SORT_PROPERTY = 'hs_timestamp';\n private const string ENGAGEMENT_MEETINGS = 'meetings';\n\n public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($engagementType === self::ENGAGEMENT_MEETINGS) {\n $payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_timestamp',\n 'hs_activity_type',\n ];\n } else {\n $payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp'];\n }\n\n return $payload;\n }\n\n public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array\n {\n $lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array\n {\n $lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';\n\n $payload = [\n 'filters' => [\n [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'GT',\n 'value' => $since->getPreciseTimestamp(3),\n ],\n [\n 'propertyName' => 'hubspot_owner_id',\n 'operator' => 'EQ',\n 'value' => $crmId,\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_object_id',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($to) {\n $payload['filters'][] = [\n 'propertyName' => $lastUpdateDate,\n 'operator' => 'LT',\n 'value' => $to->getPreciseTimestamp(3),\n ];\n }\n\n $payload['properties'] = $properties;\n\n return $payload;\n }\n\n private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array\n {\n $filters = [];\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'IN',\n 'values' => ['SCHEDULED', 'RESCHEDULED'],\n ],\n ],\n ];\n\n $filters[] = [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n [\n 'propertyName' => 'hs_meeting_outcome',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ],\n ];\n\n return $filters;\n }\n\n private function buildTaskFiltersForLinkToTask($objectType, $objectId): array\n {\n return [\n [\n 'filters' => [\n $this->getAssociatedObjectFilter($objectType, $objectId),\n ],\n ],\n ];\n }\n\n private function getAssociatedObjectFilter(string $objectType, string $objectId): array\n {\n return [\n 'propertyName' => 'associations.' . $objectType,\n 'operator' => 'EQ',\n 'value' => $objectId,\n ];\n }\n\n public function generatePlaybackURLSearchPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $activityProvider,\n ],\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'operator' => 'BETWEEN',\n 'value' => intval($from->getPreciseTimestamp(3)),\n 'highValue' => intval($to->getPreciseTimestamp(3)),\n ],\n ],\n 'sorts' => [\n [\n 'propertyName' => 'hs_timestamp',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $this->getSearchCallAttributes(),\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n 'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n }\n\n public function getSearchCallAttributes(): array\n {\n return [\n 'hs_timestamp',\n 'hs_call_recording_url',\n 'hs_call_body',\n 'hs_call_status',\n 'hs_call_to_number',\n 'hs_call_from_number',\n 'hs_call_duration',\n 'hs_call_disposition',\n 'hs_call_title',\n 'hs_call_direction',\n 'hubspot_owner_id',\n 'hs_activity_type',\n 'hs_call_external_id',\n 'hs_call_source',\n ];\n }\n\n public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array\n {\n $updateObjectsData = [];\n\n foreach ($crmUpdateData as $data) {\n $updateObjectsData[] = [\n 'id' => $data['crm_id'],\n 'properties' => [\n 'hs_call_body' => $data['hs_call_body'] .\n '<p><span style=\"font-size: 13.3333px; line-height: 16px;\">' .\n '<a href=\"' . $data['playback_url'] . '\" target=\"_blank\">Review in Jiminny</a> ▶️</span></p>',\n ],\n ];\n }\n\n return ['inputs' => $updateObjectsData];\n }\n\n public function generateSearchCallByTokenPayload(string $playbackURLToken): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => 'hs_call_recording_url',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $playbackURLToken,\n ],\n ],\n 'properties' => [\n 'hs_call_recording_url',\n 'hs_call_body',\n ],\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload for phone search based on the specified parameters.\n *\n * @param string $phone The phone number to search.\n * @param bool $isAlternativeSearch Indicates if an alternative search should be performed\n * if the first search fails to find a match. The first search request should cover most of the cases.\n */\n public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array\n {\n $filterPropertyNames = $isAlternativeSearch ?\n ['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :\n ['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];\n\n $filterGroups = array_map(function ($propertyName) use ($phone) {\n return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);\n }, $filterPropertyNames);\n\n $properties = [\n 'email',\n 'firstname',\n 'lastname',\n 'country',\n 'phone',\n 'mobilephone',\n 'jobtitle',\n 'hubspot_owner_id',\n 'associatedcompanyid',\n 'photo',\n ];\n\n return $this->createPayload($filterGroups, $properties);\n }\n\n /**\n * Creates a filter group with the specified parameters.\n */\n private function createFilterGroup(string $propertyName, string $operator, $value): array\n {\n return [\n 'filters' => [\n [\n 'propertyName' => $propertyName,\n 'operator' => $operator,\n 'value' => $value,\n ],\n ],\n ];\n }\n\n /**\n * Creates a payload with the specified filter groups and properties.\n */\n private function createPayload(array $filterGroups, array $properties): array\n {\n return [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => 'modifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n 'properties' => $properties,\n 'limit' => 1,\n ];\n }\n\n /**\n * Generates a payload to find related activities based on the specified data and object type.\n * The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)\n * and are associated with any of the provided prospect types (contact or company).\n *\n * @param array $data An associative array containing the following keys:\n * - 'from': The start time for the activity search (timestamp).\n * - 'to': The end time for the activity search (timestamp).\n * - 'contact': (optional) The ID of the associated contact.\n * - 'company': (optional) The ID of the associated company.\n * @param string $objectType The type of engagement to search for (meeting or other type like call).\n *\n * @return array The payload array to be used for searching related activities.\n */\n public function getFindRelatedActivityPayload(array $data, string $objectType): array\n {\n $payload = [\n 'sorts' => [\n [\n 'propertyName' => self::SORT_PROPERTY,\n 'direction' => 'DESCENDING',\n ],\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n if ($objectType === self::ENGAGEMENT_MEETINGS) {\n $payload['properties'] = [\n 'hs_meeting_title',\n 'hs_meeting_outcome',\n 'hs_activity_type',\n 'hs_timestamp',\n 'hubspot_owner_id',\n 'hs_meeting_body',\n 'hs_internal_meeting_notes',\n 'hs_meeting_location',\n 'hs_meeting_start_time',\n 'hs_meeting_end_time',\n ];\n } else {\n $payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];\n }\n\n $timeFiltersWithEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'LTE',\n 'value' => $data['to'],\n ],\n ];\n\n $timeFiltersWithoutEndTime = [\n [\n 'propertyName' => 'hs_meeting_start_time',\n 'operator' => 'GTE',\n 'value' => $data['from'],\n ],\n [\n 'propertyName' => 'hs_meeting_end_time',\n 'operator' => 'NOT_HAS_PROPERTY',\n ],\n ];\n\n $payload['filterGroups'] = [];\n\n $associationTypes = ['contact', 'company'];\n foreach ($associationTypes as $type) {\n if (! empty($data[$type])) {\n $filterGroupWithEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithEndTime;\n\n $filterGroupWithoutEndTime = [\n 'filters' => array_merge(\n $timeFiltersWithoutEndTime,\n [$this->getAssociatedObjectFilter($type, $data[$type])]\n ),\n ];\n $payload['filterGroups'][] = $filterGroupWithoutEndTime ;\n }\n }\n\n return $payload;\n }\n\n /** Parameters\n * [\n * 'accountId' => $crmAccountId,\n * 'sortBy' => $sortBy,\n * 'sortDir' => $sortDir,\n * 'onlyOpen' => $onlyOpen,\n * 'closedStages' => $this->getClosedDealStages(),\n * 'userId' => $userId,\n * ];\n */\n public function generateOpportunitiesSearchPayload(\n Configuration $config,\n string $crmAccountId,\n array $closedStages,\n ): array {\n $closedFilters = [];\n $filterGroups = [];\n $onlyOpen = true;\n\n switch ($config->getOpportunityAssignmentRule()) {\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'DESCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:\n $sortBy = 'createdate';\n $sortDir = 'ASCENDING';\n\n break;\n\n case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:\n default:\n $sortBy = 'modifieddate';\n $sortDir = 'DESCENDING';\n $onlyOpen = false;\n }\n\n $baseFilters = [\n [\n 'propertyName' => 'associations.company',\n 'operator' => 'EQ',\n 'value' => $crmAccountId,\n ],\n ];\n\n // Handle closed stages in chunks\n if ($onlyOpen) {\n foreach (['won', 'lost'] as $key) {\n if (! empty($closedStages[$key])) {\n $chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);\n foreach ($chunks as $chunk) {\n $closedFilters[] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $chunk,\n ];\n }\n }\n }\n }\n\n $filterGroups[] = [\n 'filters' => array_merge($baseFilters, $closedFilters),\n ];\n\n $payload = [\n 'filterGroups' => $filterGroups,\n 'sorts' => [\n [\n 'propertyName' => $sortBy,\n 'direction' => $sortDir,\n ],\n ],\n 'properties' => [\n 'dealname',\n 'amount',\n 'hubspot_owner_id',\n 'pipeline',\n 'dealstage',\n 'closedate',\n 'deal_currency_code',\n ],\n 'limit' => self::MAX_SEARCH_REQUEST_LIMIT,\n ];\n\n $logger = app(LoggerInterface::class);\n $logger->info('[HubSpot] CRM Search requested', [\n 'request' => $payload,\n ]);\n\n return $payload;\n }\n\n /**\n * Converts v1 payload data to v3\n */\n public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array\n {\n // Use this mapping until the whole Hubspot V1 is dropped.\n $properties = [\n 'hubspot_owner_id' => $engagement['ownerId'],\n 'hs_timestamp' => $engagement['timestamp'],\n ];\n\n // $engagement['activityType'] is $activity->category->name\n if (isset($engagement['activityType'])) {\n $properties['hs_activity_type'] = $engagement['activityType'];\n }\n\n $metadataKeyMap = [\n 'hs_meeting_outcome' => 'meetingOutcome',\n 'hs_meeting_title' => 'title',\n 'hs_meeting_start_time' => 'startTime',\n 'hs_meeting_end_time' => 'endTime',\n 'hs_meeting_body' => 'body',\n 'hs_internal_meeting_notes' => 'internalMeetingNotes',\n ];\n\n foreach ($metadataKeyMap as $newKey => $oldKey) {\n if (isset($metadata[$oldKey])) {\n $properties[$newKey] = $metadata[$oldKey];\n unset($metadata[$oldKey]);\n }\n }\n\n $properties = [\n ...$properties,\n ...$metadata, // custom fields\n ];\n\n $response = [\n 'properties' => $properties,\n ];\n\n if (! empty($associations)) {\n $response['associations'] = $associations;\n }\n\n return $response;\n }\n\n /**\n * Generate a payload to search for contacts by name.\n * The search is a token search in firstname or lastname\n */\n public function generateSearchContactsByNamePayload(string $name, array $fields): array\n {\n $firstNameFilter = [\n 'propertyName' => 'firstname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n $lastNameFilter = [\n 'propertyName' => 'lastname',\n 'operator' => 'CONTAINS_TOKEN',\n 'value' => $name,\n ];\n\n return [\n 'filterGroups' => [\n [\n 'filters' => [$firstNameFilter],\n ],\n [\n 'filters' => [$lastNameFilter],\n ],\n ],\n 'properties' => $fields,\n 'sorts' => [\n [\n 'propertyName' => 'lastmodifieddate',\n 'direction' => 'DESCENDING',\n ],\n ],\n ];\n }\n\n public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array\n {\n $inputs = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $inputs[] = [\n 'from' => [\n 'id' => $crmId,\n ],\n 'to' => [\n 'id' => (string) $id,\n ],\n 'types' => [\n [\n 'associationCategory' => 'HUBSPOT_DEFINED',\n 'associationTypeId' => $associationType,\n ],\n ],\n ];\n }\n\n return ['inputs' => $inputs];\n }\n\n public function buildRemoveAssociationPayload(string $crmId, array $ids): array\n {\n $toArray = [];\n foreach ($ids as $id) {\n if ($id === null || $id === '') {\n continue;\n }\n\n $toArray[] = ['id' => (string) $id];\n }\n\n return [\n 'inputs' => [\n [\n 'from' => ['id' => $crmId],\n 'to' => $toArray,\n ],\n ],\n ];\n }\n\n public function addClosedStageFilters(array &$payload, array $closedStages): void\n {\n if (! empty($closedStages['won'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['won'],\n ];\n }\n\n if (! empty($closedStages['lost'])) {\n $payload['filters'][] = [\n 'propertyName' => 'dealstage',\n 'operator' => 'NOT_IN',\n 'values' => $closedStages['lost'],\n ];\n }\n }\n\n public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void\n {\n $payload['filters'][] = [\n 'propertyName' => 'createdate',\n 'operator' => 'GT',\n 'value' => $createdAfter->getPreciseTimestamp(3),\n ];\n }\n\n public function getDealsInBulkPayload(array $dealIds): array\n {\n return [\n 'filterGroups' => [\n [\n 'filters' => [\n [\n 'propertyName' => 'hs_object_id',\n 'operator' => 'IN',\n 'values' => $dealIds,\n ],\n ],\n ],\n ],\n 'limit' => self::MAX_FILTER_SIZE,\n ];\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.40957448,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.41821808,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.42918882,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.43783244,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.44647607,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.4574468,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.46841756,"top":0.09896249,"width":0.024268618,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.4950133,"top":0.09896249,"width":0.008643617,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.50598407,"top":0.09896249,"width":0.029587766,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.7084442,"top":0.09896249,"width":0.02825798,"height":0.01915403},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9078253235426753618
|
1349767247385803396
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
master, menu
Start Listen Project: faVsco.js, menu
master, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
25
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use Carbon\Carbon;
use Jiminny\Models\Crm\Configuration;
use Psr\Log\LoggerInterface;
class PayloadBuilder
{
public const int MAX_SEARCH_REQUEST_LIMIT = 200;
private const int MAX_FILTER_SIZE = 100;
private const string SORT_PROPERTY = 'hs_timestamp';
private const string ENGAGEMENT_MEETINGS = 'meetings';
public function getLinkToTaskPayload(string $objectType, string $objectId, string $engagementType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($engagementType === self::ENGAGEMENT_MEETINGS) {
$payload['filterGroups'] = $this->buildMeetingFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_timestamp',
'hs_activity_type',
];
} else {
$payload['filterGroups'] = $this->buildTaskFiltersForLinkToTask($objectType, $objectId);
$payload['properties'] = ['hs_task_subject', 'hs_timestamp'];
}
return $payload;
}
public function getRecentlyUpdatedSearchPayload(Carbon $since, ?Carbon $to, array $properties): array
{
$lastUpdateDate = in_array('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
public function getByProfileSearchPayload(string $crmId, array $properties, Carbon $since, ?Carbon $to): array
{
$lastUpdateDate = array_key_exists('firstname', $properties) ? 'lastmodifieddate' : 'hs_lastmodifieddate';
$payload = [
'filters' => [
[
'propertyName' => $lastUpdateDate,
'operator' => 'GT',
'value' => $since->getPreciseTimestamp(3),
],
[
'propertyName' => 'hubspot_owner_id',
'operator' => 'EQ',
'value' => $crmId,
],
],
'sorts' => [
[
'propertyName' => 'hs_object_id',
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($to) {
$payload['filters'][] = [
'propertyName' => $lastUpdateDate,
'operator' => 'LT',
'value' => $to->getPreciseTimestamp(3),
];
}
$payload['properties'] = $properties;
return $payload;
}
private function buildMeetingFiltersForLinkToTask($objectType, $objectId): array
{
$filters = [];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'IN',
'values' => ['SCHEDULED', 'RESCHEDULED'],
],
],
];
$filters[] = [
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
[
'propertyName' => 'hs_meeting_outcome',
'operator' => 'NOT_HAS_PROPERTY',
],
],
];
return $filters;
}
private function buildTaskFiltersForLinkToTask($objectType, $objectId): array
{
return [
[
'filters' => [
$this->getAssociatedObjectFilter($objectType, $objectId),
],
],
];
}
private function getAssociatedObjectFilter(string $objectType, string $objectId): array
{
return [
'propertyName' => 'associations.' . $objectType,
'operator' => 'EQ',
'value' => $objectId,
];
}
public function generatePlaybackURLSearchPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
public function generateGetCallsPayload(Carbon $from, Carbon $to, string $activityProvider, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $activityProvider,
],
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function generateSearchCallsByPeriodPayload(Carbon $from, Carbon $to, $page): array
{
return [
'filters' => [
[
'propertyName' => 'hs_timestamp',
'operator' => 'BETWEEN',
'value' => intval($from->getPreciseTimestamp(3)),
'highValue' => intval($to->getPreciseTimestamp(3)),
],
],
'sorts' => [
[
'propertyName' => 'hs_timestamp',
'direction' => 'DESCENDING',
],
],
'properties' => $this->getSearchCallAttributes(),
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
'after' => ($page - 1) * self::MAX_SEARCH_REQUEST_LIMIT,
];
}
public function getSearchCallAttributes(): array
{
return [
'hs_timestamp',
'hs_call_recording_url',
'hs_call_body',
'hs_call_status',
'hs_call_to_number',
'hs_call_from_number',
'hs_call_duration',
'hs_call_disposition',
'hs_call_title',
'hs_call_direction',
'hubspot_owner_id',
'hs_activity_type',
'hs_call_external_id',
'hs_call_source',
];
}
public function generatePlaybackAddUrlBatchPayload(array $crmUpdateData): array
{
$updateObjectsData = [];
foreach ($crmUpdateData as $data) {
$updateObjectsData[] = [
'id' => $data['crm_id'],
'properties' => [
'hs_call_body' => $data['hs_call_body'] .
'<p><span style="font-size: 13.3333px; line-height: 16px;">' .
'<a href="' . $data['playback_url'] . '" target="_blank">Review in Jiminny</a> ▶️</span></p>',
],
];
}
return ['inputs' => $updateObjectsData];
}
public function generateSearchCallByTokenPayload(string $playbackURLToken): array
{
return [
'filters' => [
[
'propertyName' => 'hs_call_recording_url',
'operator' => 'CONTAINS_TOKEN',
'value' => $playbackURLToken,
],
],
'properties' => [
'hs_call_recording_url',
'hs_call_body',
],
'limit' => 1,
];
}
/**
* Generates a payload for phone search based on the specified parameters.
*
* @param string $phone The phone number to search.
* @param bool $isAlternativeSearch Indicates if an alternative search should be performed
* if the first search fails to find a match. The first search request should cover most of the cases.
*/
public function generatePhoneSearchPayload(string $phone, bool $isAlternativeSearch = false): array
{
$filterPropertyNames = $isAlternativeSearch ?
['hs_searchable_calculated_mobile_number', 'phone', 'mobilephone'] :
['hs_searchable_calculated_phone_number', 'hs_calculated_phone_number', 'hs_calculated_mobile_number'];
$filterGroups = array_map(function ($propertyName) use ($phone) {
return $this->createFilterGroup($propertyName, 'CONTAINS_TOKEN', $phone);
}, $filterPropertyNames);
$properties = [
'email',
'firstname',
'lastname',
'country',
'phone',
'mobilephone',
'jobtitle',
'hubspot_owner_id',
'associatedcompanyid',
'photo',
];
return $this->createPayload($filterGroups, $properties);
}
/**
* Creates a filter group with the specified parameters.
*/
private function createFilterGroup(string $propertyName, string $operator, $value): array
{
return [
'filters' => [
[
'propertyName' => $propertyName,
'operator' => $operator,
'value' => $value,
],
],
];
}
/**
* Creates a payload with the specified filter groups and properties.
*/
private function createPayload(array $filterGroups, array $properties): array
{
return [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => 'modifieddate',
'direction' => 'DESCENDING',
],
],
'properties' => $properties,
'limit' => 1,
];
}
/**
* Generates a payload to find related activities based on the specified data and object type.
* The search looks for activities that match the specified time range (starttime - endtime or only starttime with endtime not set)
* and are associated with any of the provided prospect types (contact or company).
*
* @param array $data An associative array containing the following keys:
* - 'from': The start time for the activity search (timestamp).
* - 'to': The end time for the activity search (timestamp).
* - 'contact': (optional) The ID of the associated contact.
* - 'company': (optional) The ID of the associated company.
* @param string $objectType The type of engagement to search for (meeting or other type like call).
*
* @return array The payload array to be used for searching related activities.
*/
public function getFindRelatedActivityPayload(array $data, string $objectType): array
{
$payload = [
'sorts' => [
[
'propertyName' => self::SORT_PROPERTY,
'direction' => 'DESCENDING',
],
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
if ($objectType === self::ENGAGEMENT_MEETINGS) {
$payload['properties'] = [
'hs_meeting_title',
'hs_meeting_outcome',
'hs_activity_type',
'hs_timestamp',
'hubspot_owner_id',
'hs_meeting_body',
'hs_internal_meeting_notes',
'hs_meeting_location',
'hs_meeting_start_time',
'hs_meeting_end_time',
];
} else {
$payload['properties'] = ['hs_task_subject', 'hs_timestamp', 'hubspot_owner_id', 'hs_call_body'];
}
$timeFiltersWithEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'LTE',
'value' => $data['to'],
],
];
$timeFiltersWithoutEndTime = [
[
'propertyName' => 'hs_meeting_start_time',
'operator' => 'GTE',
'value' => $data['from'],
],
[
'propertyName' => 'hs_meeting_end_time',
'operator' => 'NOT_HAS_PROPERTY',
],
];
$payload['filterGroups'] = [];
$associationTypes = ['contact', 'company'];
foreach ($associationTypes as $type) {
if (! empty($data[$type])) {
$filterGroupWithEndTime = [
'filters' => array_merge(
$timeFiltersWithEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithEndTime;
$filterGroupWithoutEndTime = [
'filters' => array_merge(
$timeFiltersWithoutEndTime,
[$this->getAssociatedObjectFilter($type, $data[$type])]
),
];
$payload['filterGroups'][] = $filterGroupWithoutEndTime ;
}
}
return $payload;
}
/** Parameters
* [
* 'accountId' => $crmAccountId,
* 'sortBy' => $sortBy,
* 'sortDir' => $sortDir,
* 'onlyOpen' => $onlyOpen,
* 'closedStages' => $this->getClosedDealStages(),
* 'userId' => $userId,
* ];
*/
public function generateOpportunitiesSearchPayload(
Configuration $config,
string $crmAccountId,
array $closedStages,
): array {
$closedFilters = [];
$filterGroups = [];
$onlyOpen = true;
switch ($config->getOpportunityAssignmentRule()) {
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_UPDATED:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_RECENTLY_CREATED:
$sortBy = 'createdate';
$sortDir = 'DESCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_OPEN_OLDEST_CREATED:
$sortBy = 'createdate';
$sortDir = 'ASCENDING';
break;
case Configuration::OPP_ASSIGNMENT_ALL_RECENTLY_UPDATED:
default:
$sortBy = 'modifieddate';
$sortDir = 'DESCENDING';
$onlyOpen = false;
}
$baseFilters = [
[
'propertyName' => 'associations.company',
'operator' => 'EQ',
'value' => $crmAccountId,
],
];
// Handle closed stages in chunks
if ($onlyOpen) {
foreach (['won', 'lost'] as $key) {
if (! empty($closedStages[$key])) {
$chunks = array_chunk($closedStages[$key], self::MAX_FILTER_SIZE);
foreach ($chunks as $chunk) {
$closedFilters[] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $chunk,
];
}
}
}
}
$filterGroups[] = [
'filters' => array_merge($baseFilters, $closedFilters),
];
$payload = [
'filterGroups' => $filterGroups,
'sorts' => [
[
'propertyName' => $sortBy,
'direction' => $sortDir,
],
],
'properties' => [
'dealname',
'amount',
'hubspot_owner_id',
'pipeline',
'dealstage',
'closedate',
'deal_currency_code',
],
'limit' => self::MAX_SEARCH_REQUEST_LIMIT,
];
$logger = app(LoggerInterface::class);
$logger->info('[HubSpot] CRM Search requested', [
'request' => $payload,
]);
return $payload;
}
/**
* Converts v1 payload data to v3
*/
public function getV3MeetingPayload(array $engagement, array $metadata, array $associations = []): array
{
// Use this mapping until the whole Hubspot V1 is dropped.
$properties = [
'hubspot_owner_id' => $engagement['ownerId'],
'hs_timestamp' => $engagement['timestamp'],
];
// $engagement['activityType'] is $activity->category->name
if (isset($engagement['activityType'])) {
$properties['hs_activity_type'] = $engagement['activityType'];
}
$metadataKeyMap = [
'hs_meeting_outcome' => 'meetingOutcome',
'hs_meeting_title' => 'title',
'hs_meeting_start_time' => 'startTime',
'hs_meeting_end_time' => 'endTime',
'hs_meeting_body' => 'body',
'hs_internal_meeting_notes' => 'internalMeetingNotes',
];
foreach ($metadataKeyMap as $newKey => $oldKey) {
if (isset($metadata[$oldKey])) {
$properties[$newKey] = $metadata[$oldKey];
unset($metadata[$oldKey]);
}
}
$properties = [
...$properties,
...$metadata, // custom fields
];
$response = [
'properties' => $properties,
];
if (! empty($associations)) {
$response['associations'] = $associations;
}
return $response;
}
/**
* Generate a payload to search for contacts by name.
* The search is a token search in firstname or lastname
*/
public function generateSearchContactsByNamePayload(string $name, array $fields): array
{
$firstNameFilter = [
'propertyName' => 'firstname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
$lastNameFilter = [
'propertyName' => 'lastname',
'operator' => 'CONTAINS_TOKEN',
'value' => $name,
];
return [
'filterGroups' => [
[
'filters' => [$firstNameFilter],
],
[
'filters' => [$lastNameFilter],
],
],
'properties' => $fields,
'sorts' => [
[
'propertyName' => 'lastmodifieddate',
'direction' => 'DESCENDING',
],
],
];
}
public function buildAddAssociationPayload(string $crmId, array $ids, int $associationType): array
{
$inputs = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$inputs[] = [
'from' => [
'id' => $crmId,
],
'to' => [
'id' => (string) $id,
],
'types' => [
[
'associationCategory' => 'HUBSPOT_DEFINED',
'associationTypeId' => $associationType,
],
],
];
}
return ['inputs' => $inputs];
}
public function buildRemoveAssociationPayload(string $crmId, array $ids): array
{
$toArray = [];
foreach ($ids as $id) {
if ($id === null || $id === '') {
continue;
}
$toArray[] = ['id' => (string) $id];
}
return [
'inputs' => [
[
'from' => ['id' => $crmId],
'to' => $toArray,
],
],
];
}
public function addClosedStageFilters(array &$payload, array $closedStages): void
{
if (! empty($closedStages['won'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['won'],
];
}
if (! empty($closedStages['lost'])) {
$payload['filters'][] = [
'propertyName' => 'dealstage',
'operator' => 'NOT_IN',
'values' => $closedStages['lost'],
];
}
}
public function addCreatedDateFilters(array &$payload, Carbon $createdAfter): void
{
$payload['filters'][] = [
'propertyName' => 'createdate',
'operator' => 'GT',
'value' => $createdAfter->getPreciseTimestamp(3),
];
}
public function getDealsInBulkPayload(array $dealIds): array
{
return [
'filterGroups' => [
[
'filters' => [
[
'propertyName' => 'hs_object_id',
'operator' => 'IN',
'values' => $dealIds,
],
],
],
],
'limit' => self::MAX_FILTER_SIZE,
];
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
51769
|
1819
|
2
|
2026-05-18T09:05:59.444852+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-18/1779 /Users/lukas/.screenpipe/data/data/2026-05-18/1779095159444_m1.jpg...
|
PhpStorm
|
faVsco.js – UserInvitationDTOTest.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
JY-20613-allow-owner-role Project: faVsco.js, menu
JY-20613-allow-owner-role-on-team-setup, menu
Start Listening for PHP Debug Connections
UserInvitationDTOTest
Run 'UserInvitationDTOTest'
Debug 'UserInvitationDTOTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Tests\Feature\DTO;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Models\Invitation;
use Jiminny\Models\Role;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Tests\TestCase;
final class UserInvitationDTOTest extends TestCase
{
use DatabaseTransactions;
public function testCreateFromInvitation(): void
{
/** @var Invitation $invitation */
$invitation = Invitation::factory()->create([
'email' => '[EMAIL]',
'group_id' => '1',
'team_id' => '1',
'role_id' => null,
'crm_required' => 1,
'is_owner' => 0,
]);
/** @var User $user */
$user = User::factory()->create();
/** @var Role $userRole */
$userRole = Role::whereName(User::ROLE_RECORDER)->first();
$invitation->roles()->sync($userRole);
$dto = UserInvitationDTO::fromInvitation($invitation, $user);
self::assertSame('[EMAIL]', $dto->email);
self::assertSame(1, $dto->groupId);
self::assertSame(1, $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$userRole->getId()], $dto->roleIds);
self::assertSame($user, $dto->currentUser);
}
public function testForOwner(): void
{
/** @var Team $team */
$team = Team::factory()->create();
$request = new CreateTeamRequest([
'owner_email' => '[EMAIL]',
'owner_role' => 'recorder',
]);
/** @var User $currentUser */
$currentUser = User::factory()->create();
$request->setUserResolver(static fn () => $currentUser);
$dto = UserInvitationDTO::forOwner($request, $team);
/** @var Role $recorderRole */
$recorderRole = Role::whereName(User::ROLE_RECORDER)->first();
/** @var Role $adminRole */
$adminRole = Role::whereName(User::ROLE_ADMIN)->first();
self::assertSame('[EMAIL]', $dto->email);
self::assertNull($dto->groupId);
self::assertSame($team->getId(), $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$adminRole->getId(), $recorderRole->getId()], $dto->roleIds);
self::assertSame($currentUser, $dto->currentUser);
}
public function testForOwnerWithRecorderAndVoiceRole(): void
{
/** @var Team $team */
$team = Team::factory()->create();
$request = new CreateTeamRequest([
'owner_email' => '[EMAIL]',
'owner_role' => 'recorder_and_voice',
]);
/** @var User $currentUser */
$currentUser = User::factory()->create();
$request->setUserResolver(static fn () => $currentUser);
$dto = UserInvitationDTO::forOwner($request, $team);
/** @var Role $recorderAndVoiceRole */
$recorderAndVoiceRole = Role::whereName(User::ROLE_RECORDER_AND_VOICE)->first();
/** @var Role $adminRole */
$adminRole = Role::whereName(User::ROLE_ADMIN)->first();
self::assertSame('[EMAIL]', $dto->email);
self::assertNull($dto->groupId);
self::assertSame($team->getId(), $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$adminRole->getId(), $recorderAndVoiceRole->getId()], $dto->roleIds);
self::assertSame($currentUser, $dto->currentUser);
}
public function testForOwnerWithAnalystRole(): void
{
/** @var Team $team */
$team = Team::factory()->create();
$request = new CreateTeamRequest([
'owner_email' => '[EMAIL]',
'owner_role' => 'analyst',
]);
/** @var User $currentUser */
$currentUser = User::factory()->create();
$request->setUserResolver(static fn () => $currentUser);
$dto = UserInvitationDTO::forOwner($request, $team);
/** @var Role $analystRole */
$analystRole = Role::whereName(User::ROLE_ANALYST)->first();
/** @var Role $adminRole */
$adminRole = Role::whereName(User::ROLE_ADMIN)->first();
self::assertSame('[EMAIL]', $dto->email);
self::assertNull($dto->groupId);
self::assertSame($team->getId(), $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$adminRole->getId(), $analystRole->getId()], $dto->roleIds);
self::assertSame($currentUser, $dto->currentUser);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JY-20613-allow-owner-role-on-team-setup, menu","depth":5,"on_screen":true,"help_text":"Git Branch: JY-20613-allow-owner-role-on-team-setup","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"UserInvitationDTOTest","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'UserInvitationDTOTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'UserInvitationDTOTest'","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.02111111},"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.014583333,"height":0.025555555},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Tests\\Feature\\DTO;\n\nuse Illuminate\\Foundation\\Testing\\DatabaseTransactions;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Models\\Invitation;\nuse Jiminny\\Models\\Role;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Tests\\TestCase;\n\nfinal class UserInvitationDTOTest extends TestCase\n{\n use DatabaseTransactions;\n\n public function testCreateFromInvitation(): void\n {\n /** @var Invitation $invitation */\n $invitation = Invitation::factory()->create([\n 'email' => 'Test@gmail.com',\n 'group_id' => '1',\n 'team_id' => '1',\n 'role_id' => null,\n 'crm_required' => 1,\n 'is_owner' => 0,\n ]);\n\n /** @var User $user */\n $user = User::factory()->create();\n /** @var Role $userRole */\n $userRole = Role::whereName(User::ROLE_RECORDER)->first();\n\n $invitation->roles()->sync($userRole);\n\n $dto = UserInvitationDTO::fromInvitation($invitation, $user);\n\n self::assertSame('test@gmail.com', $dto->email);\n self::assertSame(1, $dto->groupId);\n self::assertSame(1, $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$userRole->getId()], $dto->roleIds);\n self::assertSame($user, $dto->currentUser);\n }\n\n public function testForOwner(): void\n {\n /** @var Team $team */\n $team = Team::factory()->create();\n\n $request = new CreateTeamRequest([\n 'owner_email' => 'admin@jiminny.com',\n 'owner_role' => 'recorder',\n ]);\n\n /** @var User $currentUser */\n $currentUser = User::factory()->create();\n $request->setUserResolver(static fn () => $currentUser);\n\n $dto = UserInvitationDTO::forOwner($request, $team);\n\n /** @var Role $recorderRole */\n $recorderRole = Role::whereName(User::ROLE_RECORDER)->first();\n /** @var Role $adminRole */\n $adminRole = Role::whereName(User::ROLE_ADMIN)->first();\n\n self::assertSame('admin@jiminny.com', $dto->email);\n self::assertNull($dto->groupId);\n self::assertSame($team->getId(), $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$adminRole->getId(), $recorderRole->getId()], $dto->roleIds);\n self::assertSame($currentUser, $dto->currentUser);\n }\n\n public function testForOwnerWithRecorderAndVoiceRole(): void\n {\n /** @var Team $team */\n $team = Team::factory()->create();\n\n $request = new CreateTeamRequest([\n 'owner_email' => 'admin@jiminny.com',\n 'owner_role' => 'recorder_and_voice',\n ]);\n\n /** @var User $currentUser */\n $currentUser = User::factory()->create();\n $request->setUserResolver(static fn () => $currentUser);\n\n $dto = UserInvitationDTO::forOwner($request, $team);\n\n /** @var Role $recorderAndVoiceRole */\n $recorderAndVoiceRole = Role::whereName(User::ROLE_RECORDER_AND_VOICE)->first();\n /** @var Role $adminRole */\n $adminRole = Role::whereName(User::ROLE_ADMIN)->first();\n\n self::assertSame('admin@jiminny.com', $dto->email);\n self::assertNull($dto->groupId);\n self::assertSame($team->getId(), $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$adminRole->getId(), $recorderAndVoiceRole->getId()], $dto->roleIds);\n self::assertSame($currentUser, $dto->currentUser);\n }\n\n public function testForOwnerWithAnalystRole(): void\n {\n /** @var Team $team */\n $team = Team::factory()->create();\n\n $request = new CreateTeamRequest([\n 'owner_email' => 'admin@jiminny.com',\n 'owner_role' => 'analyst',\n ]);\n\n /** @var User $currentUser */\n $currentUser = User::factory()->create();\n $request->setUserResolver(static fn () => $currentUser);\n\n $dto = UserInvitationDTO::forOwner($request, $team);\n\n /** @var Role $analystRole */\n $analystRole = Role::whereName(User::ROLE_ANALYST)->first();\n /** @var Role $adminRole */\n $adminRole = Role::whereName(User::ROLE_ADMIN)->first();\n\n self::assertSame('admin@jiminny.com', $dto->email);\n self::assertNull($dto->groupId);\n self::assertSame($team->getId(), $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$adminRole->getId(), $analystRole->getId()], $dto->roleIds);\n self::assertSame($currentUser, $dto->currentUser);\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Tests\\Feature\\DTO;\n\nuse Illuminate\\Foundation\\Testing\\DatabaseTransactions;\nuse Jiminny\\DTO\\Invitation\\UserInvitationDTO;\nuse Jiminny\\Http\\Requests\\Settings\\Teams\\CreateTeamRequest;\nuse Jiminny\\Models\\Invitation;\nuse Jiminny\\Models\\Role;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Tests\\TestCase;\n\nfinal class UserInvitationDTOTest extends TestCase\n{\n use DatabaseTransactions;\n\n public function testCreateFromInvitation(): void\n {\n /** @var Invitation $invitation */\n $invitation = Invitation::factory()->create([\n 'email' => 'Test@gmail.com',\n 'group_id' => '1',\n 'team_id' => '1',\n 'role_id' => null,\n 'crm_required' => 1,\n 'is_owner' => 0,\n ]);\n\n /** @var User $user */\n $user = User::factory()->create();\n /** @var Role $userRole */\n $userRole = Role::whereName(User::ROLE_RECORDER)->first();\n\n $invitation->roles()->sync($userRole);\n\n $dto = UserInvitationDTO::fromInvitation($invitation, $user);\n\n self::assertSame('test@gmail.com', $dto->email);\n self::assertSame(1, $dto->groupId);\n self::assertSame(1, $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$userRole->getId()], $dto->roleIds);\n self::assertSame($user, $dto->currentUser);\n }\n\n public function testForOwner(): void\n {\n /** @var Team $team */\n $team = Team::factory()->create();\n\n $request = new CreateTeamRequest([\n 'owner_email' => 'admin@jiminny.com',\n 'owner_role' => 'recorder',\n ]);\n\n /** @var User $currentUser */\n $currentUser = User::factory()->create();\n $request->setUserResolver(static fn () => $currentUser);\n\n $dto = UserInvitationDTO::forOwner($request, $team);\n\n /** @var Role $recorderRole */\n $recorderRole = Role::whereName(User::ROLE_RECORDER)->first();\n /** @var Role $adminRole */\n $adminRole = Role::whereName(User::ROLE_ADMIN)->first();\n\n self::assertSame('admin@jiminny.com', $dto->email);\n self::assertNull($dto->groupId);\n self::assertSame($team->getId(), $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$adminRole->getId(), $recorderRole->getId()], $dto->roleIds);\n self::assertSame($currentUser, $dto->currentUser);\n }\n\n public function testForOwnerWithRecorderAndVoiceRole(): void\n {\n /** @var Team $team */\n $team = Team::factory()->create();\n\n $request = new CreateTeamRequest([\n 'owner_email' => 'admin@jiminny.com',\n 'owner_role' => 'recorder_and_voice',\n ]);\n\n /** @var User $currentUser */\n $currentUser = User::factory()->create();\n $request->setUserResolver(static fn () => $currentUser);\n\n $dto = UserInvitationDTO::forOwner($request, $team);\n\n /** @var Role $recorderAndVoiceRole */\n $recorderAndVoiceRole = Role::whereName(User::ROLE_RECORDER_AND_VOICE)->first();\n /** @var Role $adminRole */\n $adminRole = Role::whereName(User::ROLE_ADMIN)->first();\n\n self::assertSame('admin@jiminny.com', $dto->email);\n self::assertNull($dto->groupId);\n self::assertSame($team->getId(), $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$adminRole->getId(), $recorderAndVoiceRole->getId()], $dto->roleIds);\n self::assertSame($currentUser, $dto->currentUser);\n }\n\n public function testForOwnerWithAnalystRole(): void\n {\n /** @var Team $team */\n $team = Team::factory()->create();\n\n $request = new CreateTeamRequest([\n 'owner_email' => 'admin@jiminny.com',\n 'owner_role' => 'analyst',\n ]);\n\n /** @var User $currentUser */\n $currentUser = User::factory()->create();\n $request->setUserResolver(static fn () => $currentUser);\n\n $dto = UserInvitationDTO::forOwner($request, $team);\n\n /** @var Role $analystRole */\n $analystRole = Role::whereName(User::ROLE_ANALYST)->first();\n /** @var Role $adminRole */\n $adminRole = Role::whereName(User::ROLE_ADMIN)->first();\n\n self::assertSame('admin@jiminny.com', $dto->email);\n self::assertNull($dto->groupId);\n self::assertSame($team->getId(), $dto->teamId);\n self::assertTrue($dto->crmRequired);\n self::assertSame([$adminRole->getId(), $analystRole->getId()], $dto->roleIds);\n self::assertSame($currentUser, $dto->currentUser);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"17","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\nnamespace Jiminny\\Console;\n\nuse Illuminate\\Console\\ConfirmableTrait;\nuse Illuminate\\Console\\Scheduling\\Event;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\nuse Jiminny\\Component\\Acl\\RemoveExpiredRoleChangeEventsCommand;\nuse Jiminny\\Component\\ActionItems\\Commands\\SendActionItemsCommand;\nuse Jiminny\\Component\\AiActivityType\\Commands\\AutodetectAiActivityTypeCommand;\nuse Jiminny\\Component\\AskJiminnyAi\\Commands\\ProphetAnalyzeClosedDealsCommand;\nuse Jiminny\\Component\\Cache\\Constants;\nuse Jiminny\\Component\\DealInsights\\Commands\\SendDealsUpdateCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\MediaPipelineRestartCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportActivityProcessingTimeToDatadogCommand;\nuse Jiminny\\Component\\MediaPipeline\\Command\\ReportProcessingStatesToDatadogCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\OverrideTranscriptionLocaleCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryFailedTranscriptionsCommand;\nuse Jiminny\\Component\\Transcription\\Commands\\RetryStuckTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ActivitiesMatchCrmCommand;\nuse Jiminny\\Console\\Commands\\Activities\\AutologOldActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DeleteActivitiesForRetentionTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\DownloadMissingTrackCommand;\nuse Jiminny\\Console\\Commands\\Activities\\FixActivitiesOpportunity;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesForChurnedTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\HardDeleteActivitiesTeamsCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReassignTranscriptCommand;\nuse Jiminny\\Console\\Commands\\Activities\\ReindexRecentActivitiesCommand;\nuse Jiminny\\Console\\Commands\\Activities\\RetryProspectSummaryCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeleteCancelledCommand;\nuse Jiminny\\Console\\Commands\\Calendars\\Events\\CalendarEventDeletePastCommand;\nuse Jiminny\\Console\\Commands\\Crm\\BackfillOpportunityUserFromAccountCommand;\nuse Jiminny\\Console\\Commands\\Crm\\CleanDuplicateFieldDataCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ProcessMergedObjectsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\RestoreDealAssociationsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\ProcessHubspotObjectsSyncBatches;\nuse Jiminny\\Console\\Commands\\Crm\\PurgeDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\ListJournalWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\Hubspot\\SetupJournalDealWebhookSubscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Crm\\SyncHubspotActiveDeals;\nuse Jiminny\\Console\\Commands\\Crm\\SyncOpportunitiesMissingFieldDataCommand;\nuse Jiminny\\Console\\Commands\\DeleteOldAiCrmNotesCommand;\nuse Jiminny\\Console\\Commands\\DeleteS3LeftoversCommand;\nuse Jiminny\\Console\\Commands\\DiarizeViaAiParticipantIdentificationCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\DeleteEmailDocumentsCommand;\nuse Jiminny\\Console\\Commands\\Elasticsearch\\RemoveGhostParticipantsCommand;\nuse Jiminny\\Console\\Commands\\FlushRolesPermissionsCache;\nuse Jiminny\\Console\\Commands\\GenerateInternalWebhookToken;\nuse Jiminny\\Console\\Commands\\IssueMcpTokenCommand;\nuse Jiminny\\Console\\Commands\\HubspotJournalPollingCommand;\nuse Jiminny\\Console\\Commands\\HubspotWebhookServiceCommand;\nuse Jiminny\\Console\\Commands\\Livestream\\StopHangingLivestreamsCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteEmailMessagesWithoutActivityCommand;\nuse Jiminny\\Console\\Commands\\Mailboxes\\DeleteInboxEmailsCommand;\nuse Jiminny\\Console\\Commands\\PurgeSoftDeletedOpportunitiesCommand;\nuse Jiminny\\Console\\Commands\\PurgeSyncBatchesCommand;\nuse Jiminny\\Console\\Commands\\RemoveDeleteMarkersCommand;\nuse Jiminny\\Console\\Commands\\RemoveExpiredNudgesCommand;\nuse Jiminny\\Console\\Commands\\RemoveUnusedParticipantSpeechesCommand;\nuse Jiminny\\Console\\Commands\\Reports\\AutomatedReportsRetentionPolicyCommand;\nuse Jiminny\\Console\\Commands\\Reports\\DeleteReportCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityCrmProviderIdCommand;\nuse Jiminny\\Console\\Commands\\RestoreActivityTypeCommand;\nuse Jiminny\\Console\\Commands\\SendNudgeExpirationWarningsCommand;\nuse Jiminny\\Console\\Commands\\Slack\\SyncSlackUserCommand;\nuse Jiminny\\Console\\Commands\\Teams\\SyncTeamUsersCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamDeleteCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteDeactivatedCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamsDeleteRetentionCommand;\nuse Jiminny\\Console\\Commands\\Teams\\TeamSettingPutCommand;\nuse Jiminny\\Console\\Commands\\Teams\\UpdateTeamsCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\CleanupActivityTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\DeleteUnusedTracksCommand;\nuse Jiminny\\Console\\Commands\\Tracks\\RestoreTracksCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\DeleteOldTranscriptionsCommand;\nuse Jiminny\\Console\\Commands\\Transcription\\UpdateOldTranscriptionModelLocalesCommand;\nuse Jiminny\\Console\\Commands\\Twilio\\DeleteChurnedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\DeletePredefinedSubAccounts;\nuse Jiminny\\Console\\Commands\\Twilio\\ReleaseNumbersCommand;\nuse Jiminny\\Jobs\\Activity\\SyncActivity;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\InboxEmail;\nuse Jiminny\\Services\\RecallAI\\Commands\\ImportRegionMeetingCommand;\nuse Jiminny\\Services\\RecallAI\\Commands\\ScheduleBotCommand;\n\nclass Kernel extends ConsoleKernel\n{\n use ConfirmableTrait;\n\n /**\n * The Artisan commands provided by your application.\n *\n * @var string[]\n */\n protected $commands = [\n Commands\\GeckoExport\\GeckoExportTranscriptCommand::class,\n Commands\\GeckoExport\\GeckoExportTranscriptionCommand::class,\n Commands\\GeckoExport\\GeckoExportParticipantSpeechesCommand::class,\n Commands\\Activities\\DeleteForCoachesCommand::class,\n ReindexRecentActivitiesCommand::class,\n Commands\\Crm\\BullhornPingCommand::class,\n Commands\\Crm\\BullhornSessionCommand::class,\n Commands\\Crm\\BullhornSearchCommand::class,\n Commands\\PlaybackThemes\\TopicsConsolidateCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesCopyCommand::class,\n Commands\\PlaybackThemes\\AssignTopicsUsedBySingleTeamCommand::class,\n Commands\\PlaybackThemes\\PlaybackThemesMigrateToVersionsCommand::class,\n Commands\\Vocabulary\\VocabularyCopyCommand::class,\n Commands\\Transcription\\TranscriptionPrintRaw::class,\n Commands\\Migrate\\JiminnyMigratePopulateActivitySourceCommand::class,\n Commands\\EngagementStats\\JiminnyEngagementStatsExplainCommand::class,\n Commands\\EngagementStatsRegenerateCommand::class,\n Commands\\Analytics\\NumberOfActivitiesPerActivityTypeCommand::class,\n Commands\\Elasticsearch\\MappingRunCommand::class,\n Commands\\Elasticsearch\\MappingInstallCommand::class,\n Commands\\Elasticsearch\\UpdateEsMappingSettingsCommand::class,\n Commands\\Analytics\\TranscriptionWordMatchCommand::class,\n Commands\\JiminnyCacheClearCommand::class,\n Commands\\Transcription\\TranscriptionSearchCommand::class,\n RetryStuckTranscriptionsCommand::class,\n RetryFailedTranscriptionsCommand::class,\n Commands\\JiminnyDebugCommand::class,\n Commands\\RunAiCallScoringForUntypedActivitiesCommand::class,\n Commands\\Calendars\\SyncCalendars::class,\n Commands\\Calendars\\SyncDeletedEvents::class,\n Commands\\Twilio\\FetchMetrics::class,\n Commands\\Twilio\\FetchEvents::class,\n Commands\\Twilio\\FetchSummary::class,\n Commands\\Twilio\\SyncZoneAccess::class,\n Commands\\DatabaseTableCount::class,\n Commands\\PurgeConferences::class,\n Commands\\ResetElasticSearch::class,\n Commands\\CreateDatabaseUsers::class,\n Commands\\Activities\\NotifyNotLogged::class,\n Commands\\Crm\\SyncTeamMetadata::class,\n Commands\\Crm\\SyncProfileMetadata::class,\n Commands\\Crm\\SyncContact::class,\n Commands\\Crm\\SyncObjects::class,\n Commands\\Crm\\SyncHubspotObjects::class,\n Commands\\Crm\\SyncAccount::class,\n Commands\\Crm\\ResetGovernorLimits::class,\n Commands\\Crm\\ManageSyncStrategyCommand::class,\n Commands\\ImportRecording::class,\n Commands\\TrackImported::class,\n Commands\\Twilio\\RecoverTwilioTracksCommand::class,\n Commands\\Crm\\SetupLayouts::class,\n Commands\\Tracks\\SyncTwilioTracks::class,\n Commands\\Activities\\StatusCount::class,\n\n Commands\\Mailboxes\\TextRelay\\WatchMailboxEvents::class,\n Commands\\Mailboxes\\InboxCreate::class,\n Commands\\Mailboxes\\InboxSync::class,\n Commands\\Mailboxes\\BatchCreate::class,\n Commands\\Mailboxes\\BatchProcess::class,\n Commands\\Mailboxes\\InboxPurge::class,\n Commands\\Mailboxes\\BatchRetryFailed::class,\n Commands\\Mailboxes\\BatchFailStalled::class,\n Commands\\Mailboxes\\SkipListsRefresh::class,\n Commands\\Mailboxes\\SkipListsDump::class,\n Commands\\Mailboxes\\TextRelay\\SyncMailbox::class,\n Commands\\Mailboxes\\DeleteInboxEmailsCommand::class,\n Commands\\Mailboxes\\DeleteEmailMessagesCommand::class,\n DeleteEmailMessagesWithoutActivityCommand::class,\n\n Commands\\Tracks\\CheckIntegrity::class,\n Commands\\Twilio\\RemoteLifecycle::class,\n Commands\\Twilio\\SyncNumbers::class,\n Commands\\Crm\\SetupActivityTypeForFollowUp::class,\n Commands\\Activities\\CheckPlayable::class,\n Commands\\Activities\\ActivityDeleteCommand::class,\n Commands\\Activities\\Copy::class,\n Commands\\Activities\\ActivityHardDeleteCommand::class,\n Commands\\Reports\\Team::class,\n Commands\\Reports\\GenerateMarketingReport::class,\n Commands\\Reports\\AutomatedReportsCommand::class,\n Commands\\Reports\\AutomatedReportsSendCommand::class,\n Commands\\MuteOrganizerChannel::class,\n Commands\\Tracks\\DeleteTracks::class,\n Commands\\Tracks\\RetryDownload::class,\n Commands\\Tracks\\RetryFailedDownloads::class,\n Commands\\Twilio\\SyncAddresses::class,\n Commands\\Activities\\UpdateElasticSearch::class,\n Commands\\MakeSlackLiveCoachingChatNotesOn::class,\n Commands\\Activities\\PreMeetingNotification::class,\n ScheduleBotCommand::class,\n ImportRegionMeetingCommand::class,\n Commands\\Activities\\MonitorMeetingCountCommand::class,\n Commands\\Activities\\MonitorMeetingStartCommand::class,\n Commands\\Activities\\MonitorMeetingEndCommand::class,\n Commands\\SyncActivity::class,\n Commands\\PhpApm::class,\n Commands\\Crm\\SyncOpportunity::class,\n Commands\\Crm\\SyncLead::class,\n Commands\\Users\\SyncLicenceDataToSalesforce::class,\n Commands\\Crm\\UpdateOpportunitySpecifications::class,\n Commands\\Users\\SyncToIntercom::class,\n Commands\\Users\\SyncToUserPilot::class,\n Commands\\Teams\\SyncToPlanhat::class,\n Commands\\Twilio\\SetZoneAccess::class,\n Commands\\Users\\CreateDefaultSavedSearchesCommand::class,\n Commands\\Crm\\SendNotLogged::class,\n Commands\\Teams\\DeactivateTeamCommand::class,\n Commands\\Crm\\SyncFieldMetadata::class,\n Commands\\Postmark\\SyncEmailTemplatesCommand::class,\n Commands\\PlaybackThemes\\ImportTriggersFromTranslatedCsvCommand::class,\n Commands\\Activities\\PreMeetingReminder::class,\n Commands\\Activities\\CustomerActivitiesExport::class,\n Commands\\Users\\RefreshAccessToken::class,\n Commands\\Calendars\\SetupCalendarSubscription::class,\n Commands\\Activities\\InviteMeetingBot::class,\n Commands\\Activities\\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,\n Commands\\Crm\\MigrateProvider::class,\n Commands\\Activities\\MigrateLocationFromCalendarEventToActivities::class,\n Commands\\HelperTruncateCoachingTables::class,\n Commands\\FixCrossTenantIssues::class,\n Commands\\Activities\\CloudCall\\SetupIntegration::class,\n Commands\\Activities\\CloudTalk\\FixTimeZone::class,\n Commands\\Activities\\Orum\\SetupIntegration::class,\n Commands\\Activities\\JustCall\\SetupIntegration::class,\n Commands\\Activities\\RingCentral\\AddInboundPromptSupport::class,\n Commands\\Dialers\\Dialpad\\SubscribeToWebhooks::class,\n Commands\\RecalculateDealRisksCommand::class,\n SendDealsUpdateCommand::class,\n Commands\\Activities\\SetProviderCapabilitiesField::class,\n Commands\\Teams\\InitiallySetNotificationProviderTeamsTable::class,\n Commands\\Crm\\AddLayoutEntities::class,\n Commands\\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,\n Commands\\JiminnyTokenInfoCommand::class,\n Commands\\JiminnySetEncryptedTokenManagerModeCommand::class,\n Commands\\EncryptTokensCommand::class,\n Commands\\Dialers\\Aircall\\CheckAndRenewWebhooks::class,\n Commands\\Migrate\\MigrateTeamRegionCommand::class,\n Commands\\ManageScimForTeam::class,\n Commands\\Dialers\\SyncUsersCommand::class,\n Commands\\WhichWorkerIsWorkingOnWhichJob::class,\n Commands\\GroupSetDefaultLanguageCommand::class,\n Commands\\Dev\\AddRateLimitCommand::class,\n Commands\\Dev\\ImportCallsCommand::class,\n Commands\\DealInsights\\BuildDealInsightsLayoutCommand::class,\n Commands\\DealInsights\\DeleteAskJiminnyDealPrompts::class,\n Commands\\Crm\\MatchCrmObjectsCommand::class,\n Commands\\Activities\\SetupIntegration\\EightByEight::class,\n Commands\\Calendars\\RemoveCalendarEventActivitiesCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromGongCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromChorusCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromLeexiCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromAvomaCommand::class,\n Commands\\Activities\\Migrator\\MigrateFromClariCommand::class,\n Commands\\Activities\\SetupIntegration\\ConnectAndSell::class,\n Commands\\Activities\\SetupIntegration\\CloudTalk::class,\n Commands\\Users\\CreateConferenceSlug::class,\n Commands\\Elasticsearch\\AsyncUpdateEsEntities::class,\n Commands\\Elasticsearch\\ResetAsyncElasticSearchCommand::class,\n Commands\\Playlists\\PlaylistSharesUpdateCommand::class,\n Commands\\Crm\\AutologDelayedCommand::class,\n Commands\\Activities\\HydrateDefaultActivityTypeCommand::class,\n Commands\\Crm\\CheckActivityLoggableCommand::class,\n Commands\\Activities\\MonitorDialerActivitiesCommand::class,\n Commands\\Activities\\SetupIntegration\\Xant::class,\n Commands\\ImportUsersFromCsvFile::class,\n Commands\\DevPostmanCommand::class,\n Commands\\Playlists\\FixTreeStructureCommand::class,\n Commands\\Zoom\\ResolvePmiLinksCommand::class,\n Commands\\MarkBranchForEnvironmentPipelineCommand::class,\n Commands\\Activities\\ProbeMediaSegmentsCommand::class,\n Commands\\Activities\\SetupIntegration\\AmazonConnect::class,\n Commands\\Playbooks\\ChangePlaybookActivityFieldCommand::class,\n MediaPipelineRestartCommand::class,\n Commands\\Dev\\FixHubSpotTokens::class,\n Commands\\Dev\\MonitorSocialAccountsState::class,\n Commands\\Activities\\SetupIntegration\\Vonage::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlex::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexDirect::class,\n Commands\\Activities\\SetupIntegration\\TwilioFlexSetDialerAuthCredentialsCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioSetS3RecordingCredentialsCommand::class,\n SendActionItemsCommand::class,\n Commands\\Users\\ChangeEmail::class,\n Commands\\Calendars\\ListUserGoogleCalendars::class,\n Commands\\Activities\\JustCall\\SyncPlaybackLinkToCrmCommand::class,\n Commands\\Activities\\HydrateCallWithCrmDataCommand::class,\n Commands\\Activities\\UpdateActivityElasticSearchDocumentCommand::class,\n Commands\\Activities\\SetupIntegration\\Talkdesk::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookListCommand::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookShow::class,\n Commands\\Transcription\\Microsoft\\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,\n Commands\\Activities\\SetupIntegration\\TwilioVideo::class,\n Commands\\Crm\\SetupCloseCrm::class,\n Commands\\Crm\\SetupCopperCrm::class,\n Commands\\Crm\\FullSyncOpportunityCommand::class,\n Commands\\Crm\\IntegrationApp\\CrmEntitiesFullSyncCommand::class,\n Commands\\Crm\\IntegrationApp\\ValidateConnectionCommand::class,\n Commands\\Activities\\Workflow\\RefreshCrmData::class,\n Commands\\Activities\\Migrator\\AnalyseGongCalls::class,\n Commands\\Users\\AddVoiceRoleToRecorderCommand::class,\n Commands\\Activities\\SyncMissingCallDispositions::class,\n Commands\\Calendars\\RemoveFutureCalendarEvents::class,\n FlushRolesPermissionsCache::class,\n Commands\\Activities\\SetupIntegration\\FiveNine::class,\n CalendarEventDeleteCancelledCommand::class,\n CalendarEventDeletePastCommand::class,\n ReportActivityProcessingTimeToDatadogCommand::class,\n ReportProcessingStatesToDatadogCommand::class,\n ReleaseNumbersCommand::class,\n BackfillOpportunityUserFromAccountCommand::class,\n RemoveExpiredRoleChangeEventsCommand::class,\n RemoveExpiredNudgesCommand::class,\n SendNudgeExpirationWarningsCommand::class,\n AutologOldActivitiesCommand::class,\n RemoveUnusedParticipantSpeechesCommand::class,\n DeleteActivitiesForChurnedTeamsCommand::class,\n HardDeleteActivitiesForChurnedTeamsCommand::class,\n TeamDeleteCommand::class,\n TeamsDeleteDeactivatedCommand::class,\n UpdateTeamsCommand::class,\n OverrideTranscriptionLocaleCommand::class,\n SyncSlackUserCommand::class,\n PurgeSoftDeletedOpportunitiesCommand::class,\n PurgeSyncBatchesCommand::class,\n ProphetAnalyzeClosedDealsCommand::class,\n DeleteChurnedSubAccounts::class,\n Commands\\ProphetAi\\DumpContext::class,\n DeletePredefinedSubAccounts::class,\n DeleteActivitiesForRetentionTeamsCommand::class,\n HardDeleteActivitiesTeamsCommand::class,\n TeamsDeleteRetentionCommand::class,\n TeamSettingPutCommand::class,\n StopHangingLivestreamsCommand::class,\n FixActivitiesOpportunity::class,\n Commands\\Activities\\SetupIntegration\\Salesforce\\SetupSalesforceIntegrationCommand::class,\n UpdateOldTranscriptionModelLocalesCommand::class,\n Commands\\Dev\\FixMissMatchedCrmActivitiesCommand::class,\n DownloadMissingTrackCommand::class,\n ActivitiesMatchCrmCommand::class,\n DeleteEmailDocumentsCommand::class,\n DeleteOldTranscriptionsCommand::class,\n DeleteS3LeftoversCommand::class,\n RemoveDeleteMarkersCommand::class,\n SyncTeamUsersCommand::class,\n ReassignTranscriptCommand::class,\n DiarizeViaAiParticipantIdentificationCommand::class,\n RestoreActivityTypeCommand::class,\n DeleteOldAiCrmNotesCommand::class,\n DeleteReportCommand::class,\n AutomatedReportsRetentionPolicyCommand::class,\n SyncHubspotActiveDeals::class,\n GenerateInternalWebhookToken::class,\n IssueMcpTokenCommand::class,\n RestoreActivityCrmProviderIdCommand::class,\n CleanupActivityTracksCommand::class,\n DeleteUnusedTracksCommand::class,\n RestoreTracksCommand::class,\n HubspotWebhookServiceCommand::class,\n ProcessMergedObjectsCommand::class,\n HubspotJournalPollingCommand::class,\n SetupJournalDealWebhookSubscriptionsCommand::class,\n ListJournalWebhookSubscriptionsCommand::class,\n RemoveGhostParticipantsCommand::class,\n AutodetectAiActivityTypeCommand::class,\n Commands\\Crm\\LogActivitiesCommand::class,\n Commands\\Crm\\MatchOpportunityActivitiesCommand::class,\n PurgeDeletedOpportunitiesCommand::class,\n CleanDuplicateFieldDataCommand::class,\n RetryProspectSummaryCommand::class,\n ProcessHubspotObjectsSyncBatches::class,\n SyncOpportunitiesMissingFieldDataCommand::class,\n RestoreDealAssociationsCommand::class,\n ];\n\n private Schedule $schedule;\n private string $output;\n\n protected function schedule(Schedule $schedule): void\n {\n $this->schedule = $schedule;\n $this->output = config('jiminny.scheduler_log');\n\n $schedule->useCache('redis');\n\n $currentMinute = (int) date('i');\n $currentDay = (int) date('w');\n\n $this->scheduleEveryMinute();\n $this->scheduleEveryTwoMinutes();\n $this->scheduleEveryFiveMinutes();\n $this->scheduleEveryTenMinutes();\n $this->scheduleEveryFifteenMinutes();\n $this->scheduleEveryThirtyMinutes();\n $this->scheduleHourly();\n $this->scheduleDaily();\n $this->scheduleWeekly($currentDay);\n $this->scheduleSpecificTimes();\n $this->scheduleDynamic($currentMinute);\n }\n\n protected function scheduleEveryMinute(): void\n {\n $this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();\n $this->scheduleCommand('dialers:monitor-activities')->everyMinute();\n $this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();\n $this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();\n\n $this->schedule->command('mailbox:batch:process', ['--max-batches=15'])\n ->everyMinute()\n ->sendOutputTo($this->output);\n }\n\n protected function scheduleEveryTwoMinutes(): void\n {\n $this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();\n }\n\n protected function scheduleEveryFiveMinutes(): void\n {\n $this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();\n // Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)\n $this->scheduleCommand('crm:sync-hubspot-objects', [], 4)\n ->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');\n $this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();\n $this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();\n $this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();\n\n $this->schedule->command('mailbox:batch:create')\n ->cron('2-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output);\n\n $this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])\n ->cron('3-59/5 * * * *')\n ->withoutOverlapping(180)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ->runInBackground();\n\n $this->schedule->command('hubspot:journal-poll', ['--start'])\n ->everyFiveMinutes()\n ->sendOutputTo($this->output)\n ->runInBackground();\n }\n\n protected function scheduleEveryTenMinutes(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();\n $this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');\n $this->scheduleCommand('crm:reset-governor')->everyTenMinutes();\n }\n\n protected function scheduleEveryFifteenMinutes(): void\n {\n $this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();\n $this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');\n $this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');\n $this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n ],\n ])->everyFifteenMinutes();\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_RINGCENTRAL,\n Activity::PROVIDER_AVAYA,\n Activity::PROVIDER_TELUS,\n Activity::PROVIDER_TALKDESK,\n '--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->cron('7,22,37,52 * * * *');\n }\n\n protected function scheduleEveryThirtyMinutes(): void\n {\n $this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');\n $this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();\n\n $this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)\n ->between('02:58', '05:29')\n ->everyThirtyMinutes()\n ->runInBackground();\n\n $this->scheduleActivitiesHardDelete();\n }\n\n protected function scheduleHourly(): void\n {\n $this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();\n $this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');\n $this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');\n $this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');\n $this->scheduleCommand('automated-reports:send')->hourly();\n $this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);\n $this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);\n }\n\n protected function scheduleDaily(): void\n {\n $this->scheduleCommand('teams:sync-planhat')->daily();\n $this->scheduleCommand('twilio:sync-addresses')->daily();\n $this->scheduleCommand('twilio:sync-zone-access')->daily();\n $this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();\n $this->scheduleCommand('users:sync-licence-data')->daily();\n $this->scheduleCommand('users:sync-intercom-data')->daily();\n $this->scheduleCommand('nudges:send-expiration-warnings')->daily();\n $this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();\n }\n\n protected function scheduleWeekly(int $currentDay): void\n {\n if ($currentDay === 0) {\n $this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);\n }\n\n if ($currentDay === 6) {\n $this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_AMAZON_CONNECT,\n '--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->saturdays()->at('01:00')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)\n ->saturdays()->at('01:07')->runInBackground();\n $this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)\n ->saturdays()->at('05:08')->runInBackground();\n $this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')\n ->weeklyOn(6, '6:00');\n $this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')\n ->weeklyOn(6, '7:00');\n }\n }\n\n protected function scheduleSpecificTimes(): void\n {\n $this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_DISCARDED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:20')->runInBackground();\n\n $this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [\n '--status' => InboxEmail::STATUS_PROCESSED,\n '--to' => now()->subWeeks(2)->format('Y-m-d'),\n ])->saturdays()->at('00:30')->runInBackground();\n\n $this->scheduleCommand('automated-reports')->dailyAt('01:00');\n $this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');\n $this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');\n $this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');\n $this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');\n $this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');\n $this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');\n\n $this->scheduleCommand('activity:sync', [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('03:05');\n\n\n $this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');\n $this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');\n $this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');\n $this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');\n $this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');\n\n if (! $this->app->environment('production')) {\n $this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)\n ->dailyAt('04:02')->runInBackground();\n }\n\n $this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');\n\n $this->scheduleCommand('activity:sync', [\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--skipProviders' => [\n Activity::PROVIDER_VONAGE,\n Activity::PROVIDER_FIVE_NINE,\n ],\n ])->dailyAt('05:05');\n\n if (! $this->app->environment('qa')) {\n $this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');\n }\n\n $this->scheduleCommand('activity:sync-dispositions', [\n Activity::PROVIDER_HUBSPOT,\n '--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->dailyAt('07:05');\n }\n\n protected function scheduleDynamic(int $currentMinute): void\n {\n $this->scheduleHourlyFallbackActivitySyncs($currentMinute);\n $this->scheduleBullhornHeartbeat($currentMinute);\n }\n\n private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void\n {\n if ($offsetMinute === 0) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);\n } elseif ($offsetMinute === 1) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);\n } elseif ($offsetMinute === 2) {\n $this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);\n }\n }\n\n private function scheduleBullhornHeartbeat(int $currentMinute): void\n {\n $bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);\n if ($bhHeartbeatInterval > 0) {\n $minutes = max((int) floor($bhHeartbeatInterval / 60), 1);\n if ($currentMinute % $minutes === 0) {\n $bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);\n if ($minutes > 30) {\n $bhEvent->hourly();\n } else {\n $bhEvent->cron(sprintf('*/%d * * * *', $minutes));\n }\n }\n }\n }\n\n private function scheduleActivitiesHardDelete(): void\n {\n if (config(key: 'jiminny.deploy_region') === 'eu') {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 1000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n } elseif ($this->app->environment('production')) {\n $this->scheduleCommand(\n name: 'activities:hard-delete',\n options: ['--limit' => 2000, '--jobs' => 20],\n expiresAt: 29\n )\n ->between('02:59', '07:02')->everyThirtyMinutes()\n ->runInBackground();\n }\n }\n\n private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void\n {\n $this->scheduleCommand('activity:sync', [\n $provider,\n '--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n '--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),\n ])->hourlyAt($offsetMinute);\n }\n\n /**\n * Register the Closure based commands for the application.\n */\n protected function commands(): void\n {\n require_once base_path('routes/console.php');\n }\n\n private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event\n {\n return $this->schedule\n ->command($name, $options)\n ->withoutOverlapping($expiresAt)\n ->onOneServer()\n ->sendOutputTo($this->output)\n ;\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9078215988176852680
|
-8722498441836407083
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
JY-20613-allow-owner-role Project: faVsco.js, menu
JY-20613-allow-owner-role-on-team-setup, menu
Start Listening for PHP Debug Connections
UserInvitationDTOTest
Run 'UserInvitationDTOTest'
Debug 'UserInvitationDTOTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
1
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Tests\Feature\DTO;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Jiminny\DTO\Invitation\UserInvitationDTO;
use Jiminny\Http\Requests\Settings\Teams\CreateTeamRequest;
use Jiminny\Models\Invitation;
use Jiminny\Models\Role;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Tests\TestCase;
final class UserInvitationDTOTest extends TestCase
{
use DatabaseTransactions;
public function testCreateFromInvitation(): void
{
/** @var Invitation $invitation */
$invitation = Invitation::factory()->create([
'email' => '[EMAIL]',
'group_id' => '1',
'team_id' => '1',
'role_id' => null,
'crm_required' => 1,
'is_owner' => 0,
]);
/** @var User $user */
$user = User::factory()->create();
/** @var Role $userRole */
$userRole = Role::whereName(User::ROLE_RECORDER)->first();
$invitation->roles()->sync($userRole);
$dto = UserInvitationDTO::fromInvitation($invitation, $user);
self::assertSame('[EMAIL]', $dto->email);
self::assertSame(1, $dto->groupId);
self::assertSame(1, $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$userRole->getId()], $dto->roleIds);
self::assertSame($user, $dto->currentUser);
}
public function testForOwner(): void
{
/** @var Team $team */
$team = Team::factory()->create();
$request = new CreateTeamRequest([
'owner_email' => '[EMAIL]',
'owner_role' => 'recorder',
]);
/** @var User $currentUser */
$currentUser = User::factory()->create();
$request->setUserResolver(static fn () => $currentUser);
$dto = UserInvitationDTO::forOwner($request, $team);
/** @var Role $recorderRole */
$recorderRole = Role::whereName(User::ROLE_RECORDER)->first();
/** @var Role $adminRole */
$adminRole = Role::whereName(User::ROLE_ADMIN)->first();
self::assertSame('[EMAIL]', $dto->email);
self::assertNull($dto->groupId);
self::assertSame($team->getId(), $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$adminRole->getId(), $recorderRole->getId()], $dto->roleIds);
self::assertSame($currentUser, $dto->currentUser);
}
public function testForOwnerWithRecorderAndVoiceRole(): void
{
/** @var Team $team */
$team = Team::factory()->create();
$request = new CreateTeamRequest([
'owner_email' => '[EMAIL]',
'owner_role' => 'recorder_and_voice',
]);
/** @var User $currentUser */
$currentUser = User::factory()->create();
$request->setUserResolver(static fn () => $currentUser);
$dto = UserInvitationDTO::forOwner($request, $team);
/** @var Role $recorderAndVoiceRole */
$recorderAndVoiceRole = Role::whereName(User::ROLE_RECORDER_AND_VOICE)->first();
/** @var Role $adminRole */
$adminRole = Role::whereName(User::ROLE_ADMIN)->first();
self::assertSame('[EMAIL]', $dto->email);
self::assertNull($dto->groupId);
self::assertSame($team->getId(), $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$adminRole->getId(), $recorderAndVoiceRole->getId()], $dto->roleIds);
self::assertSame($currentUser, $dto->currentUser);
}
public function testForOwnerWithAnalystRole(): void
{
/** @var Team $team */
$team = Team::factory()->create();
$request = new CreateTeamRequest([
'owner_email' => '[EMAIL]',
'owner_role' => 'analyst',
]);
/** @var User $currentUser */
$currentUser = User::factory()->create();
$request->setUserResolver(static fn () => $currentUser);
$dto = UserInvitationDTO::forOwner($request, $team);
/** @var Role $analystRole */
$analystRole = Role::whereName(User::ROLE_ANALYST)->first();
/** @var Role $adminRole */
$adminRole = Role::whereName(User::ROLE_ADMIN)->first();
self::assertSame('[EMAIL]', $dto->email);
self::assertNull($dto->groupId);
self::assertSame($team->getId(), $dto->teamId);
self::assertTrue($dto->crmRequired);
self::assertSame([$adminRole->getId(), $analystRole->getId()], $dto->roleIds);
self::assertSame($currentUser, $dto->currentUser);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
6
17
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Console;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Jiminny\Component\Acl\RemoveExpiredRoleChangeEventsCommand;
use Jiminny\Component\ActionItems\Commands\SendActionItemsCommand;
use Jiminny\Component\AiActivityType\Commands\AutodetectAiActivityTypeCommand;
use Jiminny\Component\AskJiminnyAi\Commands\ProphetAnalyzeClosedDealsCommand;
use Jiminny\Component\Cache\Constants;
use Jiminny\Component\DealInsights\Commands\SendDealsUpdateCommand;
use Jiminny\Component\MediaPipeline\Command\MediaPipelineRestartCommand;
use Jiminny\Component\MediaPipeline\Command\ReportActivityProcessingTimeToDatadogCommand;
use Jiminny\Component\MediaPipeline\Command\ReportProcessingStatesToDatadogCommand;
use Jiminny\Component\Transcription\Commands\OverrideTranscriptionLocaleCommand;
use Jiminny\Component\Transcription\Commands\RetryFailedTranscriptionsCommand;
use Jiminny\Component\Transcription\Commands\RetryStuckTranscriptionsCommand;
use Jiminny\Console\Commands\Activities\ActivitiesMatchCrmCommand;
use Jiminny\Console\Commands\Activities\AutologOldActivitiesCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\DeleteActivitiesForRetentionTeamsCommand;
use Jiminny\Console\Commands\Activities\DownloadMissingTrackCommand;
use Jiminny\Console\Commands\Activities\FixActivitiesOpportunity;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesForChurnedTeamsCommand;
use Jiminny\Console\Commands\Activities\HardDeleteActivitiesTeamsCommand;
use Jiminny\Console\Commands\Activities\ReassignTranscriptCommand;
use Jiminny\Console\Commands\Activities\ReindexRecentActivitiesCommand;
use Jiminny\Console\Commands\Activities\RetryProspectSummaryCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeleteCancelledCommand;
use Jiminny\Console\Commands\Calendars\Events\CalendarEventDeletePastCommand;
use Jiminny\Console\Commands\Crm\BackfillOpportunityUserFromAccountCommand;
use Jiminny\Console\Commands\Crm\CleanDuplicateFieldDataCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ProcessMergedObjectsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\RestoreDealAssociationsCommand;
use Jiminny\Console\Commands\Crm\ProcessHubspotObjectsSyncBatches;
use Jiminny\Console\Commands\Crm\PurgeDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\Crm\Hubspot\ListJournalWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\Hubspot\SetupJournalDealWebhookSubscriptionsCommand;
use Jiminny\Console\Commands\Crm\SyncHubspotActiveDeals;
use Jiminny\Console\Commands\Crm\SyncOpportunitiesMissingFieldDataCommand;
use Jiminny\Console\Commands\DeleteOldAiCrmNotesCommand;
use Jiminny\Console\Commands\DeleteS3LeftoversCommand;
use Jiminny\Console\Commands\DiarizeViaAiParticipantIdentificationCommand;
use Jiminny\Console\Commands\Elasticsearch\DeleteEmailDocumentsCommand;
use Jiminny\Console\Commands\Elasticsearch\RemoveGhostParticipantsCommand;
use Jiminny\Console\Commands\FlushRolesPermissionsCache;
use Jiminny\Console\Commands\GenerateInternalWebhookToken;
use Jiminny\Console\Commands\IssueMcpTokenCommand;
use Jiminny\Console\Commands\HubspotJournalPollingCommand;
use Jiminny\Console\Commands\HubspotWebhookServiceCommand;
use Jiminny\Console\Commands\Livestream\StopHangingLivestreamsCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteEmailMessagesWithoutActivityCommand;
use Jiminny\Console\Commands\Mailboxes\DeleteInboxEmailsCommand;
use Jiminny\Console\Commands\PurgeSoftDeletedOpportunitiesCommand;
use Jiminny\Console\Commands\PurgeSyncBatchesCommand;
use Jiminny\Console\Commands\RemoveDeleteMarkersCommand;
use Jiminny\Console\Commands\RemoveExpiredNudgesCommand;
use Jiminny\Console\Commands\RemoveUnusedParticipantSpeechesCommand;
use Jiminny\Console\Commands\Reports\AutomatedReportsRetentionPolicyCommand;
use Jiminny\Console\Commands\Reports\DeleteReportCommand;
use Jiminny\Console\Commands\RestoreActivityCrmProviderIdCommand;
use Jiminny\Console\Commands\RestoreActivityTypeCommand;
use Jiminny\Console\Commands\SendNudgeExpirationWarningsCommand;
use Jiminny\Console\Commands\Slack\SyncSlackUserCommand;
use Jiminny\Console\Commands\Teams\SyncTeamUsersCommand;
use Jiminny\Console\Commands\Teams\TeamDeleteCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteDeactivatedCommand;
use Jiminny\Console\Commands\Teams\TeamsDeleteRetentionCommand;
use Jiminny\Console\Commands\Teams\TeamSettingPutCommand;
use Jiminny\Console\Commands\Teams\UpdateTeamsCommand;
use Jiminny\Console\Commands\Tracks\CleanupActivityTracksCommand;
use Jiminny\Console\Commands\Tracks\DeleteUnusedTracksCommand;
use Jiminny\Console\Commands\Tracks\RestoreTracksCommand;
use Jiminny\Console\Commands\Transcription\DeleteOldTranscriptionsCommand;
use Jiminny\Console\Commands\Transcription\UpdateOldTranscriptionModelLocalesCommand;
use Jiminny\Console\Commands\Twilio\DeleteChurnedSubAccounts;
use Jiminny\Console\Commands\Twilio\DeletePredefinedSubAccounts;
use Jiminny\Console\Commands\Twilio\ReleaseNumbersCommand;
use Jiminny\Jobs\Activity\SyncActivity;
use Jiminny\Models\Activity;
use Jiminny\Models\InboxEmail;
use Jiminny\Services\RecallAI\Commands\ImportRegionMeetingCommand;
use Jiminny\Services\RecallAI\Commands\ScheduleBotCommand;
class Kernel extends ConsoleKernel
{
use ConfirmableTrait;
/**
* The Artisan commands provided by your application.
*
* @var string[]
*/
protected $commands = [
Commands\GeckoExport\GeckoExportTranscriptCommand::class,
Commands\GeckoExport\GeckoExportTranscriptionCommand::class,
Commands\GeckoExport\GeckoExportParticipantSpeechesCommand::class,
Commands\Activities\DeleteForCoachesCommand::class,
ReindexRecentActivitiesCommand::class,
Commands\Crm\BullhornPingCommand::class,
Commands\Crm\BullhornSessionCommand::class,
Commands\Crm\BullhornSearchCommand::class,
Commands\PlaybackThemes\TopicsConsolidateCommand::class,
Commands\PlaybackThemes\PlaybackThemesCopyCommand::class,
Commands\PlaybackThemes\AssignTopicsUsedBySingleTeamCommand::class,
Commands\PlaybackThemes\PlaybackThemesMigrateToVersionsCommand::class,
Commands\Vocabulary\VocabularyCopyCommand::class,
Commands\Transcription\TranscriptionPrintRaw::class,
Commands\Migrate\JiminnyMigratePopulateActivitySourceCommand::class,
Commands\EngagementStats\JiminnyEngagementStatsExplainCommand::class,
Commands\EngagementStatsRegenerateCommand::class,
Commands\Analytics\NumberOfActivitiesPerActivityTypeCommand::class,
Commands\Elasticsearch\MappingRunCommand::class,
Commands\Elasticsearch\MappingInstallCommand::class,
Commands\Elasticsearch\UpdateEsMappingSettingsCommand::class,
Commands\Analytics\TranscriptionWordMatchCommand::class,
Commands\JiminnyCacheClearCommand::class,
Commands\Transcription\TranscriptionSearchCommand::class,
RetryStuckTranscriptionsCommand::class,
RetryFailedTranscriptionsCommand::class,
Commands\JiminnyDebugCommand::class,
Commands\RunAiCallScoringForUntypedActivitiesCommand::class,
Commands\Calendars\SyncCalendars::class,
Commands\Calendars\SyncDeletedEvents::class,
Commands\Twilio\FetchMetrics::class,
Commands\Twilio\FetchEvents::class,
Commands\Twilio\FetchSummary::class,
Commands\Twilio\SyncZoneAccess::class,
Commands\DatabaseTableCount::class,
Commands\PurgeConferences::class,
Commands\ResetElasticSearch::class,
Commands\CreateDatabaseUsers::class,
Commands\Activities\NotifyNotLogged::class,
Commands\Crm\SyncTeamMetadata::class,
Commands\Crm\SyncProfileMetadata::class,
Commands\Crm\SyncContact::class,
Commands\Crm\SyncObjects::class,
Commands\Crm\SyncHubspotObjects::class,
Commands\Crm\SyncAccount::class,
Commands\Crm\ResetGovernorLimits::class,
Commands\Crm\ManageSyncStrategyCommand::class,
Commands\ImportRecording::class,
Commands\TrackImported::class,
Commands\Twilio\RecoverTwilioTracksCommand::class,
Commands\Crm\SetupLayouts::class,
Commands\Tracks\SyncTwilioTracks::class,
Commands\Activities\StatusCount::class,
Commands\Mailboxes\TextRelay\WatchMailboxEvents::class,
Commands\Mailboxes\InboxCreate::class,
Commands\Mailboxes\InboxSync::class,
Commands\Mailboxes\BatchCreate::class,
Commands\Mailboxes\BatchProcess::class,
Commands\Mailboxes\InboxPurge::class,
Commands\Mailboxes\BatchRetryFailed::class,
Commands\Mailboxes\BatchFailStalled::class,
Commands\Mailboxes\SkipListsRefresh::class,
Commands\Mailboxes\SkipListsDump::class,
Commands\Mailboxes\TextRelay\SyncMailbox::class,
Commands\Mailboxes\DeleteInboxEmailsCommand::class,
Commands\Mailboxes\DeleteEmailMessagesCommand::class,
DeleteEmailMessagesWithoutActivityCommand::class,
Commands\Tracks\CheckIntegrity::class,
Commands\Twilio\RemoteLifecycle::class,
Commands\Twilio\SyncNumbers::class,
Commands\Crm\SetupActivityTypeForFollowUp::class,
Commands\Activities\CheckPlayable::class,
Commands\Activities\ActivityDeleteCommand::class,
Commands\Activities\Copy::class,
Commands\Activities\ActivityHardDeleteCommand::class,
Commands\Reports\Team::class,
Commands\Reports\GenerateMarketingReport::class,
Commands\Reports\AutomatedReportsCommand::class,
Commands\Reports\AutomatedReportsSendCommand::class,
Commands\MuteOrganizerChannel::class,
Commands\Tracks\DeleteTracks::class,
Commands\Tracks\RetryDownload::class,
Commands\Tracks\RetryFailedDownloads::class,
Commands\Twilio\SyncAddresses::class,
Commands\Activities\UpdateElasticSearch::class,
Commands\MakeSlackLiveCoachingChatNotesOn::class,
Commands\Activities\PreMeetingNotification::class,
ScheduleBotCommand::class,
ImportRegionMeetingCommand::class,
Commands\Activities\MonitorMeetingCountCommand::class,
Commands\Activities\MonitorMeetingStartCommand::class,
Commands\Activities\MonitorMeetingEndCommand::class,
Commands\SyncActivity::class,
Commands\PhpApm::class,
Commands\Crm\SyncOpportunity::class,
Commands\Crm\SyncLead::class,
Commands\Users\SyncLicenceDataToSalesforce::class,
Commands\Crm\UpdateOpportunitySpecifications::class,
Commands\Users\SyncToIntercom::class,
Commands\Users\SyncToUserPilot::class,
Commands\Teams\SyncToPlanhat::class,
Commands\Twilio\SetZoneAccess::class,
Commands\Users\CreateDefaultSavedSearchesCommand::class,
Commands\Crm\SendNotLogged::class,
Commands\Teams\DeactivateTeamCommand::class,
Commands\Crm\SyncFieldMetadata::class,
Commands\Postmark\SyncEmailTemplatesCommand::class,
Commands\PlaybackThemes\ImportTriggersFromTranslatedCsvCommand::class,
Commands\Activities\PreMeetingReminder::class,
Commands\Activities\CustomerActivitiesExport::class,
Commands\Users\RefreshAccessToken::class,
Commands\Calendars\SetupCalendarSubscription::class,
Commands\Activities\InviteMeetingBot::class,
Commands\Activities\ChangeActivitiesPlaybookCategoryOnPlaybookChange::class,
Commands\Crm\MigrateProvider::class,
Commands\Activities\MigrateLocationFromCalendarEventToActivities::class,
Commands\HelperTruncateCoachingTables::class,
Commands\FixCrossTenantIssues::class,
Commands\Activities\CloudCall\SetupIntegration::class,
Commands\Activities\CloudTalk\FixTimeZone::class,
Commands\Activities\Orum\SetupIntegration::class,
Commands\Activities\JustCall\SetupIntegration::class,
Commands\Activities\RingCentral\AddInboundPromptSupport::class,
Commands\Dialers\Dialpad\SubscribeToWebhooks::class,
Commands\RecalculateDealRisksCommand::class,
SendDealsUpdateCommand::class,
Commands\Activities\SetProviderCapabilitiesField::class,
Commands\Teams\InitiallySetNotificationProviderTeamsTable::class,
Commands\Crm\AddLayoutEntities::class,
Commands\PropagateCoachingFeedbackCreatedAtToSectionFeedbacks::class,
Commands\JiminnyTokenInfoCommand::class,
Commands\JiminnySetEncryptedTokenManagerModeCommand::class,
Commands\EncryptTokensCommand::class,
Commands\Dialers\Aircall\CheckAndRenewWebhooks::class,
Commands\Migrate\MigrateTeamRegionCommand::class,
Commands\ManageScimForTeam::class,
Commands\Dialers\SyncUsersCommand::class,
Commands\WhichWorkerIsWorkingOnWhichJob::class,
Commands\GroupSetDefaultLanguageCommand::class,
Commands\Dev\AddRateLimitCommand::class,
Commands\Dev\ImportCallsCommand::class,
Commands\DealInsights\BuildDealInsightsLayoutCommand::class,
Commands\DealInsights\DeleteAskJiminnyDealPrompts::class,
Commands\Crm\MatchCrmObjectsCommand::class,
Commands\Activities\SetupIntegration\EightByEight::class,
Commands\Calendars\RemoveCalendarEventActivitiesCommand::class,
Commands\Activities\Migrator\MigrateFromGongCommand::class,
Commands\Activities\Migrator\MigrateFromChorusCommand::class,
Commands\Activities\Migrator\MigrateFromLeexiCommand::class,
Commands\Activities\Migrator\MigrateFromAvomaCommand::class,
Commands\Activities\Migrator\MigrateFromClariCommand::class,
Commands\Activities\SetupIntegration\ConnectAndSell::class,
Commands\Activities\SetupIntegration\CloudTalk::class,
Commands\Users\CreateConferenceSlug::class,
Commands\Elasticsearch\AsyncUpdateEsEntities::class,
Commands\Elasticsearch\ResetAsyncElasticSearchCommand::class,
Commands\Playlists\PlaylistSharesUpdateCommand::class,
Commands\Crm\AutologDelayedCommand::class,
Commands\Activities\HydrateDefaultActivityTypeCommand::class,
Commands\Crm\CheckActivityLoggableCommand::class,
Commands\Activities\MonitorDialerActivitiesCommand::class,
Commands\Activities\SetupIntegration\Xant::class,
Commands\ImportUsersFromCsvFile::class,
Commands\DevPostmanCommand::class,
Commands\Playlists\FixTreeStructureCommand::class,
Commands\Zoom\ResolvePmiLinksCommand::class,
Commands\MarkBranchForEnvironmentPipelineCommand::class,
Commands\Activities\ProbeMediaSegmentsCommand::class,
Commands\Activities\SetupIntegration\AmazonConnect::class,
Commands\Playbooks\ChangePlaybookActivityFieldCommand::class,
MediaPipelineRestartCommand::class,
Commands\Dev\FixHubSpotTokens::class,
Commands\Dev\MonitorSocialAccountsState::class,
Commands\Activities\SetupIntegration\Vonage::class,
Commands\Activities\SetupIntegration\TwilioFlex::class,
Commands\Activities\SetupIntegration\TwilioFlexDirect::class,
Commands\Activities\SetupIntegration\TwilioFlexSetDialerAuthCredentialsCommand::class,
Commands\Activities\SetupIntegration\TwilioSetS3RecordingCredentialsCommand::class,
SendActionItemsCommand::class,
Commands\Users\ChangeEmail::class,
Commands\Calendars\ListUserGoogleCalendars::class,
Commands\Activities\JustCall\SyncPlaybackLinkToCrmCommand::class,
Commands\Activities\HydrateCallWithCrmDataCommand::class,
Commands\Activities\UpdateActivityElasticSearchDocumentCommand::class,
Commands\Activities\SetupIntegration\Talkdesk::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookRegisterCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookListCommand::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookShow::class,
Commands\Transcription\Microsoft\TranscriptionProviderMicrosoftWebhookDeleteCommand::class,
Commands\Activities\SetupIntegration\TwilioVideo::class,
Commands\Crm\SetupCloseCrm::class,
Commands\Crm\SetupCopperCrm::class,
Commands\Crm\FullSyncOpportunityCommand::class,
Commands\Crm\IntegrationApp\CrmEntitiesFullSyncCommand::class,
Commands\Crm\IntegrationApp\ValidateConnectionCommand::class,
Commands\Activities\Workflow\RefreshCrmData::class,
Commands\Activities\Migrator\AnalyseGongCalls::class,
Commands\Users\AddVoiceRoleToRecorderCommand::class,
Commands\Activities\SyncMissingCallDispositions::class,
Commands\Calendars\RemoveFutureCalendarEvents::class,
FlushRolesPermissionsCache::class,
Commands\Activities\SetupIntegration\FiveNine::class,
CalendarEventDeleteCancelledCommand::class,
CalendarEventDeletePastCommand::class,
ReportActivityProcessingTimeToDatadogCommand::class,
ReportProcessingStatesToDatadogCommand::class,
ReleaseNumbersCommand::class,
BackfillOpportunityUserFromAccountCommand::class,
RemoveExpiredRoleChangeEventsCommand::class,
RemoveExpiredNudgesCommand::class,
SendNudgeExpirationWarningsCommand::class,
AutologOldActivitiesCommand::class,
RemoveUnusedParticipantSpeechesCommand::class,
DeleteActivitiesForChurnedTeamsCommand::class,
HardDeleteActivitiesForChurnedTeamsCommand::class,
TeamDeleteCommand::class,
TeamsDeleteDeactivatedCommand::class,
UpdateTeamsCommand::class,
OverrideTranscriptionLocaleCommand::class,
SyncSlackUserCommand::class,
PurgeSoftDeletedOpportunitiesCommand::class,
PurgeSyncBatchesCommand::class,
ProphetAnalyzeClosedDealsCommand::class,
DeleteChurnedSubAccounts::class,
Commands\ProphetAi\DumpContext::class,
DeletePredefinedSubAccounts::class,
DeleteActivitiesForRetentionTeamsCommand::class,
HardDeleteActivitiesTeamsCommand::class,
TeamsDeleteRetentionCommand::class,
TeamSettingPutCommand::class,
StopHangingLivestreamsCommand::class,
FixActivitiesOpportunity::class,
Commands\Activities\SetupIntegration\Salesforce\SetupSalesforceIntegrationCommand::class,
UpdateOldTranscriptionModelLocalesCommand::class,
Commands\Dev\FixMissMatchedCrmActivitiesCommand::class,
DownloadMissingTrackCommand::class,
ActivitiesMatchCrmCommand::class,
DeleteEmailDocumentsCommand::class,
DeleteOldTranscriptionsCommand::class,
DeleteS3LeftoversCommand::class,
RemoveDeleteMarkersCommand::class,
SyncTeamUsersCommand::class,
ReassignTranscriptCommand::class,
DiarizeViaAiParticipantIdentificationCommand::class,
RestoreActivityTypeCommand::class,
DeleteOldAiCrmNotesCommand::class,
DeleteReportCommand::class,
AutomatedReportsRetentionPolicyCommand::class,
SyncHubspotActiveDeals::class,
GenerateInternalWebhookToken::class,
IssueMcpTokenCommand::class,
RestoreActivityCrmProviderIdCommand::class,
CleanupActivityTracksCommand::class,
DeleteUnusedTracksCommand::class,
RestoreTracksCommand::class,
HubspotWebhookServiceCommand::class,
ProcessMergedObjectsCommand::class,
HubspotJournalPollingCommand::class,
SetupJournalDealWebhookSubscriptionsCommand::class,
ListJournalWebhookSubscriptionsCommand::class,
RemoveGhostParticipantsCommand::class,
AutodetectAiActivityTypeCommand::class,
Commands\Crm\LogActivitiesCommand::class,
Commands\Crm\MatchOpportunityActivitiesCommand::class,
PurgeDeletedOpportunitiesCommand::class,
CleanDuplicateFieldDataCommand::class,
RetryProspectSummaryCommand::class,
ProcessHubspotObjectsSyncBatches::class,
SyncOpportunitiesMissingFieldDataCommand::class,
RestoreDealAssociationsCommand::class,
];
private Schedule $schedule;
private string $output;
protected function schedule(Schedule $schedule): void
{
$this->schedule = $schedule;
$this->output = config('jiminny.scheduler_log');
$schedule->useCache('redis');
$currentMinute = (int) date('i');
$currentDay = (int) date('w');
$this->scheduleEveryMinute();
$this->scheduleEveryTwoMinutes();
$this->scheduleEveryFiveMinutes();
$this->scheduleEveryTenMinutes();
$this->scheduleEveryFifteenMinutes();
$this->scheduleEveryThirtyMinutes();
$this->scheduleHourly();
$this->scheduleDaily();
$this->scheduleWeekly($currentDay);
$this->scheduleSpecificTimes();
$this->scheduleDynamic($currentMinute);
}
protected function scheduleEveryMinute(): void
{
$this->scheduleCommand('meeting-bot:schedule-bot', expiresAt: 1)->everyMinute();
$this->scheduleCommand('dialers:monitor-activities')->everyMinute();
$this->scheduleCommand('jiminny:monitor-social-accounts')->everyMinute();
$this->scheduleCommand('mailbox:skip-lists:refresh')->everyMinute();
$this->schedule->command('mailbox:batch:process', ['--max-batches=15'])
->everyMinute()
->sendOutputTo($this->output);
}
protected function scheduleEveryTwoMinutes(): void
{
$this->scheduleCommand('conference:monitor:count', [], 2)->everyTwoMinutes();
}
protected function scheduleEveryFiveMinutes(): void
{
$this->scheduleCommand('activity:purge-stale', [], 4)->everyFiveMinutes();
// Offset by 1 minute to avoid overlap with crm:sync-objects (runs at :14 and :44)
$this->scheduleCommand('crm:sync-hubspot-objects', [], 4)
->cron('1,6,11,16,21,26,31,36,41,46,51,56 * * * *');
$this->scheduleCommand('mailbox:text-relay:sync')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-notification', [], 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:start', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('conference:monitor:end', expiresAt: 3)->everyFiveMinutes();
$this->scheduleCommand('jiminny:fix-hubspot-tokens')->everyFiveMinutes();
$this->scheduleCommand('conference:pre-meeting-reminder')->everyFiveMinutes()->runInBackground();
$this->schedule->command('mailbox:batch:create')
->cron('2-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output);
$this->schedule->command('mailbox:batch:retry-failed', ['--max-batches=15'])
->cron('3-59/5 * * * *')
->withoutOverlapping(180)
->onOneServer()
->sendOutputTo($this->output)
->runInBackground();
$this->schedule->command('hubspot:journal-poll', ['--start'])
->everyFiveMinutes()
->sendOutputTo($this->output)
->runInBackground();
}
protected function scheduleEveryTenMinutes(): void
{
$this->scheduleCommand('jiminny:transcription:retry-failed')->everyTenMinutes();
$this->scheduleCommand('activity:notify-not-logged')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('activity:status-count')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('mailbox:sync')->cron('6,16,26,36,46,56 * * * *');
$this->scheduleCommand('crm:reset-governor')->everyTenMinutes();
}
protected function scheduleEveryFifteenMinutes(): void
{
$this->scheduleCommand('datadog:report:processing-sla-activities')->everyFifteenMinutes();
$this->scheduleCommand('calendar:sync', ['--dateMode=daily'], 14)->cron('13,28,43,58 * * * *');
$this->scheduleCommand('activity:aircall:check-and-renew')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('track:retry-failed-downloads')->cron('9,24,39,54 * * * *');
$this->scheduleCommand('crm:autolog-delayed')->cron('3,18,33,48 * * * *');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
],
])->everyFifteenMinutes();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_RINGCENTRAL,
Activity::PROVIDER_AVAYA,
Activity::PROVIDER_TELUS,
Activity::PROVIDER_TALKDESK,
'--from' => now()->subMinutes(16)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->cron('7,22,37,52 * * * *');
}
protected function scheduleEveryThirtyMinutes(): void
{
$this->scheduleCommand('crm:sync-objects')->cron('14,44 * * * *');
$this->scheduleCommand('mailbox:batch:fail-stalled')->everyThirtyMinutes();
$this->scheduleCommand('activities:delete-activities-for-deactivated-teams', expiresAt: 5)
->between('02:58', '05:29')
->everyThirtyMinutes()
->runInBackground();
$this->scheduleActivitiesHardDelete();
}
protected function scheduleHourly(): void
{
$this->scheduleCommand('jiminny:transcription:retry-stuck')->hourly();
$this->scheduleCommand('twilio:recover-tracks')->cron('22 * * * *');
$this->scheduleCommand('dialers:sync-users')->cron('22 * * * *');
$this->scheduleCommand('datadog:report:failed-processing-states')->cron('22 * * * *');
$this->scheduleCommand('automated-reports:send')->hourly();
$this->scheduleCommand('deal-insights:send-update')->hourlyAt(0);
$this->scheduleCommand('crm:integration-app-validate-team-connection')->hourlyAt(23);
}
protected function scheduleDaily(): void
{
$this->scheduleCommand('teams:sync-planhat')->daily();
$this->scheduleCommand('twilio:sync-addresses')->daily();
$this->scheduleCommand('twilio:sync-zone-access')->daily();
$this->scheduleCommand('mailbox:text-relay:watch-text-events')->daily();
$this->scheduleCommand('users:sync-licence-data')->daily();
$this->scheduleCommand('users:sync-intercom-data')->daily();
$this->scheduleCommand('nudges:send-expiration-warnings')->daily();
$this->scheduleCommand('nudges-data-clean-up', ['--deleteExpiredNudges'])->daily();
}
protected function scheduleWeekly(int $currentDay): void
{
if ($currentDay === 0) {
$this->scheduleCommand('crm:update-opp-specs')->weeklyOn(0);
}
if ($currentDay === 6) {
$this->scheduleCommand('jiminny:acl:remove-expired-role-change-events')->saturdays();
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_AMAZON_CONNECT,
'--from' => now()->subDays(7)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->saturdays()->at('01:00')->runInBackground();
$this->scheduleCommand('calendar:event:delete-past', ['--force'], 60)
->saturdays()->at('01:07')->runInBackground();
$this->scheduleCommand('calendar:event:delete-cancelled', ['--force'], 60 * 47 + 52)
->saturdays()->at('05:08')->runInBackground();
$this->scheduleCommand('nudges-data-clean-up --squashNudgeRuns')
->weeklyOn(6, '6:00');
$this->scheduleCommand('nudges-data-clean-up --pruneOldRuns --retentionDays=35')
->weeklyOn(6, '7:00');
}
}
protected function scheduleSpecificTimes(): void
{
$this->scheduleCommand('deal-risks:calculate', ['--cronjob'])->dailyAt('00:00');
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_DISCARDED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:20')->runInBackground();
$this->scheduleCommand(DeleteInboxEmailsCommand::NAME, [
'--status' => InboxEmail::STATUS_PROCESSED,
'--to' => now()->subWeeks(2)->format('Y-m-d'),
])->saturdays()->at('00:30')->runInBackground();
$this->scheduleCommand('automated-reports')->dailyAt('01:00');
$this->scheduleCommand('crm:sync-team-metadata')->dailyAt('01:05');
$this->scheduleCommand('crm:sync-profile-metadata')->dailyAt('01:05');
$this->scheduleCommand('calendar:sync-deleted-events')->dailyAt('01:10');
$this->scheduleCommand('teams:delete-retention')->dailyAt('02:55');
$this->scheduleCommand('teams:delete-deactivated')->dailyAt('02:58');
$this->scheduleCommand('twilio:remote-lifecycle')->dailyAt('03:00');
$this->scheduleCommand('activity:sync', [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('03:05');
$this->scheduleCommand('activities:delete-retention-teams', expiresAt: 240)->dailyAt('03:04');
$this->scheduleCommand('automated-reports:run-retention-policy', expiresAt: 120)->dailyAt('03:15');
$this->scheduleCommand('stop:hanging:livestreams')->dailyAt('03:30');
$this->scheduleCommand('crm:purge-sync-batches')->dailyAt('03:45');
$this->scheduleCommand('twilio:sync-numbers')->dailyAt('04:00');
if (! $this->app->environment('production')) {
$this->scheduleCommand('activities:hard-delete', ['--limit' => 1000, '--jobs' => 5], 60)
->dailyAt('04:02')->runInBackground();
}
$this->scheduleCommand('crm:full-sync-opportunity')->dailyAt('05:00');
$this->scheduleCommand('activity:sync', [
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--skipProviders' => [
Activity::PROVIDER_VONAGE,
Activity::PROVIDER_FIVE_NINE,
],
])->dailyAt('05:05');
if (! $this->app->environment('qa')) {
$this->scheduleCommand('ai-crm-notes:delete-old')->dailyAt('07:00');
}
$this->scheduleCommand('activity:sync-dispositions', [
Activity::PROVIDER_HUBSPOT,
'--from' => now()->subDay()->startOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->subDay()->endOfDay()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->dailyAt('07:05');
}
protected function scheduleDynamic(int $currentMinute): void
{
$this->scheduleHourlyFallbackActivitySyncs($currentMinute);
$this->scheduleBullhornHeartbeat($currentMinute);
}
private function scheduleHourlyFallbackActivitySyncs(int $offsetMinute): void
{
if ($offsetMinute === 0) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUD_TALK, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_VONAGE, 6, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_CLOUDCALL_US, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_FIVE_NINE, 3, 0);
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_HUBSPOT, 1, 0);
} elseif ($offsetMinute === 1) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_RINGCENTRAL, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 1);
} elseif ($offsetMinute === 2) {
$this->scheduleHourlyFallbackActivitySync(Activity::PROVIDER_AVAYA, Constants::RINGCENTRAL_CALL_LOG_LOOK_BACK_HOURS, 2);
}
}
private function scheduleBullhornHeartbeat(int $currentMinute): void
{
$bhHeartbeatInterval = config('services.bullhorn.heartbeatInterval', 0);
if ($bhHeartbeatInterval > 0) {
$minutes = max((int) floor($bhHeartbeatInterval / 60), 1);
if ($currentMinute % $minutes === 0) {
$bhEvent = $this->scheduleCommand('crm:bullhorn:ping', ['--heartbeat']);
if ($minutes > 30) {
$bhEvent->hourly();
} else {
$bhEvent->cron(sprintf('*/%d * * * *', $minutes));
}
}
}
}
private function scheduleActivitiesHardDelete(): void
{
if (config(key: 'jiminny.deploy_region') === 'eu') {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 1000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
} elseif ($this->app->environment('production')) {
$this->scheduleCommand(
name: 'activities:hard-delete',
options: ['--limit' => 2000, '--jobs' => 20],
expiresAt: 29
)
->between('02:59', '07:02')->everyThirtyMinutes()
->runInBackground();
}
}
private function scheduleHourlyFallbackActivitySync(string $provider, int $hours, int $offsetMinute = 0): void
{
$this->scheduleCommand('activity:sync', [
$provider,
'--from' => now()->subHours($hours)->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
'--to' => now()->startOfMinute()->format(SyncActivity::ALLOWED_DATE_FORMAT),
])->hourlyAt($offsetMinute);
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
require_once base_path('routes/console.php');
}
private function scheduleCommand(string $name, array $options = [], $expiresAt = 60 * 3): Event
{
return $this->schedule
->command($name, $options)
->withoutOverlapping($expiresAt)
->onOneServer()
->sendOutputTo($this->output)
;
}
}...
|
51765
|
NULL
|
NULL
|
NULL
|
|
80007
|
2795
|
12
|
2026-05-28T06:51:40.546474+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-28/1779 /Users/lukas/.screenpipe/data/data/2026-05-28/1779951100546_m2.jpg...
|
iTerm2
|
NULL
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
ActivityMoneSIUCKcolRotonWindow@ Describe what you ActivityMoneSIUCKcolRotonWindow@ Describe what you are looking forSiminnY …**platorm-tiC.# generalAdd canvas7 Files# happy_birthday* [bu-team-into# jiminny-bg* platrorm-tickets# product launchesMonday. May 18thv TAMCROEKRhUcer done nat tvA snu dathenecessary access rights' when trying to seeanother team's performance scored withhwewin tasm inciotte hhe hoon rieha# randomwith Platform team and assigned to StoyanTomov. The Priority is P2 Medium# releases# supportt thank-yousAutomation for Jira APP 6:13 PMSRD-6865 Coaching and Framework useris not able to save their work has heen* the people of fimi.raised with Platform team and assigned to• Tho Drinritvic "A Direct messagesPetko Kashin…totrechy MavtttA Stefka StovanovaTodor StamatovStelivan GeorgieyAutomation for Jira APP 11:29 AMSRD-6871 Sensi.Ai - Call data not loggingto HubSoot activity has been raised withPlatform team and assiened to StoyanVesmoneronysreMelumo MiraNikolay YankovYactordayvStoyan Tomov. Galva DimitrovaAUon conTorirAY 80PSRD-6881 [On demandl Transcription inJames GrahamLukas Kovaliweoseendsooers mhs beenriseewith Platform team and assianed to ** ThePriority is "l:: Apps-tl Jira CloudMescaze #platform-tickets+ AaCoodls Calaoesrchlttans outttC Sess ontirans ormer.onoC Stacetranstormer.ondS89c sactrans ormec.ond) TeamDomainTransformec.ohd8) Teamintcaration Transformer8) Team Transtormec ohoc) Themetirand ormes.choc)Tooic transtormer onoc)Tooic troced trane ormer.oheerealrne nrmor nhre llleor tane nmot nane Wolcodcroeehlind Mmornhrc Korol ahrphp api.phpecrmeontrober.orcustomiosravelloSF (iminny@localhost)un crm fields (jiminnytalocalhost) x# HS Jocal jiminny@tocalhost# consolel poonTmerone(©) FieldTransformer.php x composer.ison• DockerfileA console (EU]A console [STAGING)Ty:AlrowDLQwEOgMCSVVLL+Oe7- WHERE id IN (1885, 3014)=•OROER 81 wuid (UULD with tine-low a-:ae con_configuration_id v* Bcrn_provider_id U#8 label M1885 S8a51d4d-8ca7-49f0-9b2c-e16027877ccS39 ReninderDateTimeReminder Date/Tineool Snobctaul..3814 a3d3dfSa-eaa1-43d0-b95e-1ff4bec8c42839 picktestmulti cpicktestnultd Stield): arrayKauitwailue"detau twallueLsobnect typen>crn_provider_1dsctectoole(Field Sfield): PCollection& Svalues = Sfield->values) "LOP"TYPE POKEST de svalues = Stleld-svaluesconolex. He need to check if this field has any record type constrainteSthis-sorofile->(SSield-sobiecttype . 'RecordTvoe'})&s SrecordTvoe->SieldValues@-yahere("con Sieldid' Ssield->id)-sexists()// Fetch the values specific for this record type.Svalues = Srecordtype->fieldValues)->ahere(crn_field_1d, Sfield->id)->geto:1f (Sthis->noDefault) {Fonssch vallae se Swaime?asuaimnese darant= teaxreturn Sthis->collection(Svalues, new FieldValueTransfornerO)vecterdavlrner hensewietCNUL-PICKIALEVOITOO%L7Thu 28 May 9:51:40+0.The backend API is now correctiy returning the multi-picklist field with cations. The issue is in the frontend vue-co)ponents pockoco lelrosnienere oocomimity woecon cornoerworskeverence Pattern trom Dealinsignts/DealView DetaisView DetansView.vue)Delwwascripswitch (tfelaTvoe)torrclolwoe curtencycace "Anta".formFieldType = "date"breokformFieldtype = "select",ondeldivoeseuleseleceor aporcopfre suldoaevehrankformFieldtype = "number",orcanFiles to Uodate in vue-comoonente packaae.Tthe seiwwesummary comconeot that raodersradeAny field type mapping logic that converts CRM field types to form field type:Next Steoss1.Uodate the vue-cosponents package to handie au tcoicktisr tyoe2. Bump the version in the package3. Uodate the dependency in /f ront-end//oackage, fson to the new versior4. Run yarn install to get the updated packagThe backend fix is complete and working correctly. The field is being returned with options, but the frontendcomoonent donsn't know how to render entetcotcklet heide vetAsk anything Xol@ Code swioThzioehkP4 s...
|
NULL
|
9078108145858349244
|
NULL
|
click
|
ocr
|
NULL
|
ActivityMoneSIUCKcolRotonWindow@ Describe what you ActivityMoneSIUCKcolRotonWindow@ Describe what you are looking forSiminnY …**platorm-tiC.# generalAdd canvas7 Files# happy_birthday* [bu-team-into# jiminny-bg* platrorm-tickets# product launchesMonday. May 18thv TAMCROEKRhUcer done nat tvA snu dathenecessary access rights' when trying to seeanother team's performance scored withhwewin tasm inciotte hhe hoon rieha# randomwith Platform team and assigned to StoyanTomov. The Priority is P2 Medium# releases# supportt thank-yousAutomation for Jira APP 6:13 PMSRD-6865 Coaching and Framework useris not able to save their work has heen* the people of fimi.raised with Platform team and assigned to• Tho Drinritvic "A Direct messagesPetko Kashin…totrechy MavtttA Stefka StovanovaTodor StamatovStelivan GeorgieyAutomation for Jira APP 11:29 AMSRD-6871 Sensi.Ai - Call data not loggingto HubSoot activity has been raised withPlatform team and assiened to StoyanVesmoneronysreMelumo MiraNikolay YankovYactordayvStoyan Tomov. Galva DimitrovaAUon conTorirAY 80PSRD-6881 [On demandl Transcription inJames GrahamLukas Kovaliweoseendsooers mhs beenriseewith Platform team and assianed to ** ThePriority is "l:: Apps-tl Jira CloudMescaze #platform-tickets+ AaCoodls Calaoesrchlttans outttC Sess ontirans ormer.onoC Stacetranstormer.ondS89c sactrans ormec.ond) TeamDomainTransformec.ohd8) Teamintcaration Transformer8) Team Transtormec ohoc) Themetirand ormes.choc)Tooic transtormer onoc)Tooic troced trane ormer.oheerealrne nrmor nhre llleor tane nmot nane Wolcodcroeehlind Mmornhrc Korol ahrphp api.phpecrmeontrober.orcustomiosravelloSF (iminny@localhost)un crm fields (jiminnytalocalhost) x# HS Jocal jiminny@tocalhost# consolel poonTmerone(©) FieldTransformer.php x composer.ison• DockerfileA console (EU]A console [STAGING)Ty:AlrowDLQwEOgMCSVVLL+Oe7- WHERE id IN (1885, 3014)=•OROER 81 wuid (UULD with tine-low a-:ae con_configuration_id v* Bcrn_provider_id U#8 label M1885 S8a51d4d-8ca7-49f0-9b2c-e16027877ccS39 ReninderDateTimeReminder Date/Tineool Snobctaul..3814 a3d3dfSa-eaa1-43d0-b95e-1ff4bec8c42839 picktestmulti cpicktestnultd Stield): arrayKauitwailue"detau twallueLsobnect typen>crn_provider_1dsctectoole(Field Sfield): PCollection& Svalues = Sfield->values) "LOP"TYPE POKEST de svalues = Stleld-svaluesconolex. He need to check if this field has any record type constrainteSthis-sorofile->(SSield-sobiecttype . 'RecordTvoe'})&s SrecordTvoe->SieldValues@-yahere("con Sieldid' Ssield->id)-sexists()// Fetch the values specific for this record type.Svalues = Srecordtype->fieldValues)->ahere(crn_field_1d, Sfield->id)->geto:1f (Sthis->noDefault) {Fonssch vallae se Swaime?asuaimnese darant= teaxreturn Sthis->collection(Svalues, new FieldValueTransfornerO)vecterdavlrner hensewietCNUL-PICKIALEVOITOO%L7Thu 28 May 9:51:40+0.The backend API is now correctiy returning the multi-picklist field with cations. The issue is in the frontend vue-co)ponents pockoco lelrosnienere oocomimity woecon cornoerworskeverence Pattern trom Dealinsignts/DealView DetaisView DetansView.vue)Delwwascripswitch (tfelaTvoe)torrclolwoe curtencycace "Anta".formFieldType = "date"breokformFieldtype = "select",ondeldivoeseuleseleceor aporcopfre suldoaevehrankformFieldtype = "number",orcanFiles to Uodate in vue-comoonente packaae.Tthe seiwwesummary comconeot that raodersradeAny field type mapping logic that converts CRM field types to form field type:Next Steoss1.Uodate the vue-cosponents package to handie au tcoicktisr tyoe2. Bump the version in the package3. Uodate the dependency in /f ront-end//oackage, fson to the new versior4. Run yarn install to get the updated packagThe backend fix is complete and working correctly. The field is being returned with options, but the frontendcomoonent donsn't know how to render entetcotcklet heide vetAsk anything Xol@ Code swioThzioehkP4 s...
|
80005
|
NULL
|
NULL
|
NULL
|
|
45214
|
1621
|
48
|
2026-05-14T14:25:20.401337+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768720401_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.2777778,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.2777778,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.27555555,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.27555555,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
45221
|
1621
|
52
|
2026-05-14T14:25:34.827219+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768734827_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.2777778,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.2777778,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.27555555,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.27555555,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
45223
|
1621
|
54
|
2026-05-14T14:25:51.793414+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768751793_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.2777778,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.2777778,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.27555555,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.27555555,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
45225
|
1622
|
29
|
2026-05-14T14:25:53.944966+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768753944_m2.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.2962101,"top":1.0,"width":0.03856383,"height":-0.019952059},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.33477393,"top":1.0,"width":0.122340426,"height":-0.019952059},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.5731383,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.5884308,"top":1.0,"width":0.076130316,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.66456115,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.67586434,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.6871675,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.7150931,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.72639626,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.73769945,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"bounds":{"left":0.41023937,"top":0.0015961692,"width":0.31848404,"height":0.99840385},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.28224733,"top":1.0,"width":0.024268618,"height":-0.04788506},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
45220
|
NULL
|
NULL
|
NULL
|
|
45231
|
1621
|
59
|
2026-05-14T14:26:10.555075+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768770555_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.3122222,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.3122222,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.31,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.31,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
45229
|
NULL
|
NULL
|
NULL
|
|
45271
|
1624
|
12
|
2026-05-14T14:28:10.357930+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768890357_m2.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.2962101,"top":1.0,"width":0.03856383,"height":-0.019952059},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.33477393,"top":1.0,"width":0.122340426,"height":-0.019952059},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.5731383,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.5884308,"top":1.0,"width":0.076130316,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.66456115,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.67586434,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.6871675,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.7150931,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.72639626,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.73769945,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"bounds":{"left":0.43882978,"top":0.5434956,"width":0.31848404,"height":0.4565044},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.28224733,"top":1.0,"width":0.024268618,"height":-0.04788506},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
45269
|
NULL
|
NULL
|
NULL
|
|
45272
|
1623
|
16
|
2026-05-14T14:28:11.160963+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778768891160_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.3122222,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.3122222,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.31,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.31,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
45270
|
NULL
|
NULL
|
NULL
|
|
45430
|
1625
|
61
|
2026-05-14T14:36:27.095100+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778769387095_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.3122222,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.3122222,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.31,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.31,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
45431
|
1626
|
36
|
2026-05-14T14:36:27.317044+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778769387317_m2.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.2962101,"top":1.0,"width":0.03856383,"height":-0.019952059},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.33477393,"top":1.0,"width":0.122340426,"height":-0.019952059},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.5731383,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.5884308,"top":1.0,"width":0.076130316,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.66456115,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.67586434,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.6871675,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.7150931,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.72639626,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.73769945,"top":1.0,"width":0.011303191,"height":-0.019952059},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"bounds":{"left":0.43716756,"top":0.15722266,"width":0.31848404,"height":0.8427774},"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.28224733,"top":1.0,"width":0.024268618,"height":-0.04788506},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
45427
|
NULL
|
NULL
|
NULL
|
|
45433
|
1625
|
63
|
2026-05-14T14:36:34.119078+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-14/1778 /Users/lukas/.screenpipe/data/data/2026-05-14/1778769394119_m1.jpg...
|
PhpStorm
|
faVsco.js – LogActivityTrait.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.054166667,"top":0.027777778,"width":0.08055556,"height":0.035555556},"on_screen":true,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#12066 on JY-20725-handle-HS-search-rate-limit, menu","depth":5,"bounds":{"left":0.13472222,"top":0.027777778,"width":0.25555557,"height":0.035555556},"on_screen":true,"help_text":"Pull request #12066 exists for current branch JY-20725-handle-HS-search-rate-limit, but local branch is out of sync with remote","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.6326389,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"HandleHubspotRateLimitTest","depth":6,"bounds":{"left":0.6645833,"top":0.027777778,"width":0.15902779,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.82361114,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'HandleHubspotRateLimitTest'","depth":6,"bounds":{"left":0.8472222,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.87083334,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.9291667,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9527778,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9763889,"top":0.027777778,"width":0.023611112,"height":0.035555556},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6","depth":4,"bounds":{"left":0.78194445,"top":0.3122222,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.80277777,"top":0.3122222,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.8215278,"top":0.31,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.8368056,"top":0.31,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","depth":4,"on_screen":true,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Crm\\Salesforce\\ServiceTraits;\n\nuse Illuminate\\Events\\Dispatcher;\nuse Jiminny\\Events\\Activities\\Crm\\ActivityLeadConverted;\nuse Jiminny\\Exceptions\\HttpNotFoundException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Models\\Activity;\nuse Jiminny\\Models\\Crm\\Configuration;\nuse Jiminny\\Models\\Crm\\Field;\nuse Jiminny\\Models\\Crm\\Profile;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Lead;\nuse Jiminny\\Models\\Playbook;\nuse Jiminny\\Models\\PlaybookCategory;\nuse Jiminny\\Services\\Crm\\Helpers\\CrmHelperRepository;\nuse Jiminny\\Services\\Crm\\Salesforce\\DecorateActivity;\nuse Jiminny\\Services\\Crm\\Salesforce\\PayloadBuilder;\nuse Psr\\Log\\LoggerInterface;\n\ntrait LogActivityTrait\n{\n public ?Configuration $config;\n public ?Profile $profile;\n\n protected PayloadBuilder $payloadBuilder;\n protected LoggerInterface $logger;\n protected Dispatcher $eventDispatcher;\n protected CrmHelperRepository $crmHelperRepository;\n protected ?DecorateActivity $decorateActivity = null;\n\n abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;\n abstract public function matchesCrmType(PlaybookCategory $category): bool;\n\n abstract public function syncLead(string $crmId): ?Lead;\n abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;\n abstract public function createRecord(string $objectType, array $data): string;\n abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;\n\n /**\n * Save an activity, update CRM prospect objects\n *\n * Create or update a task or event (depending on most applicable playbook)\n */\n public function saveActivity(Activity $activity): Activity\n {\n $playbook = $this->getPlaybookFromActivity($activity);\n\n if ($playbook === null) {\n throw new InvalidArgumentException('Please configure a Playbook first.');\n }\n\n $this->logger->info('[Salesforce] Log activity', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n ]);\n\n $payload = [\n 'OwnerId' => $this->profile->getCrmProviderId(),\n 'Description' => $this->getActivityDecorator()->generateDescription($activity),\n ];\n\n $payload += $this->buildSubjectPayload($activity, $playbook);\n $payload += $this->buildProspectPayload($activity);\n\n $crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK\n ? Field::OBJECT_TASK\n : Field::OBJECT_EVENT;\n\n $this->logger->info('[Salesforce] Log activity. Payload Prepared', [\n 'activity_id' => $activity->getId(),\n 'object_type' => $playbook->getActivityType(),\n 'crm_object_type' => $crmObjectType,\n 'payload' => $payload,\n ]);\n\n $this->saveCrmObject($crmObjectType, $activity, $payload);\n\n return $activity;\n }\n\n private function buildSubjectPayload(Activity $activity, Playbook $playbook): array\n {\n if ($this->matchesCrmType($activity->getCategory())) {\n /**\n * If the activity playbook category name (i.e. activity type) matches a known activity type that exists\n * in the CRM, then we set the activity type in the payload.\n * Some activity types may be locally created. They shouldn't be sent to Salesforce.\n *\n * The resulting payload attribute will look like:\n * `Type` => 'Cold Call'\n */\n return [\n /** ActivityFieldID => ActivityType */\n $playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),\n 'Subject' => $this->getActivityDecorator()->generateTitle($activity),\n ];\n }\n\n /**\n * Building of the title seems very inconsistent\n * Subject here will be something like:\n * \"Local activity type: Activity Title\"\n */\n $subject = $activity->getCategory()->getName();\n if ($activity->getTitle() !== null) {\n $subject .= ': ' . $activity->getTitle();\n }\n\n return ['Subject' => $subject];\n }\n\n private function buildProspectPayload(Activity $activity): array\n {\n $payload = [];\n\n if ($activity->getAccountId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'account_id' => $activity->getAccountId(),\n 'opportunity_id' => $activity->getOpportunityId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $hasLinkFeature = $this->crmHelperRepository->hasFeature(\n $activity,\n FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS\n );\n\n if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())\n || (! $hasLinkFeature && $activity->getOpportunityId())\n ) {\n $payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();\n } else {\n $payload['WhatId'] = $activity->getAccount()->getCrmProviderId();\n }\n }\n\n if ($activity->getContactId()) {\n $this->logger->info('[Salesforce] Activity has account id', [\n 'activity_id' => $activity->getId(),\n 'contact_id' => $activity->getContactId(),\n ]);\n\n $payload['WhoId'] = $activity->getContact()->getCrmProviderId();\n } elseif ($activity->getLeadId()) {\n $this->logger->info('[Salesforce] Activity has lead id', [\n 'activity_id' => $activity->getId(),\n 'lead_id' => $activity->getLeadId(),\n ]);\n\n /**\n * An activity may have:\n * a) a contact | account | opportunity (or combinations)\n * b) only a lead\n * c) none of the above\n *\n * An activity should not have a lead, and another prospect object at the same time.\n *\n * This logical flow should not happen naturally, but as a fallback: if an activity has both\n * a Lead and an Account, the account's WhatId takes precedence in the CRM payload.\n * The lead association will be detached locally, but the account WhatId is preserved in Salesforce.\n */\n $payload += $this->handleActivityLead($activity);\n }\n\n return $payload;\n }\n\n private function handleActivityLead(Activity $activity): array\n {\n $this->logger->info('[Salesforce] Activity sync lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Sync lead to pull fresh data. Leads change often,\n * they may get 'converted', and we must handle the new state accordingly\n */\n try {\n $activityLead = $this->syncLead(\n $activity->getLead()->getCrmProviderId()\n );\n } catch (HttpNotFoundException) {\n $this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not found, maybe it's remotely deleted\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n if ($activityLead === null) {\n $this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [\n 'activity_id' => $activity->getId(),\n ]);\n\n /**\n * Lead is not loaded, for some reason. It may be remotely found, but locally deleted.\n * Or an important Lead property may be missing, and it cannot be fully imported.\n */\n $this->resetLeadAssociation($activity);\n\n return [];\n }\n\n /**\n * The lead is not converted, directly use it as WhoId and move on.\n */\n if ($activityLead->getConvertedAt() === null) {\n return [\n 'WhoId' => $activity->getLead()->getCrmProviderId(),\n 'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.\n ];\n }\n\n /**\n * Task/Event payload properties for the CRM update\n */\n $whoId = null;\n $whatId = null;\n\n /**\n * Activity payload properties, that need to be updated.\n */\n $convertedOpportunityId = null;\n $convertedAccountId = null;\n $convertedContactId = null;\n $value = null;\n\n /**\n * If there is converted opportunity, it will update the activity stage.\n * If there isn't an opportunity, a converted account/contact cannot have a stage id,\n * so the activity shouldn't have a stage either.\n */\n $stageId = null;\n\n /**\n * The lead is definitely converted.\n * This means the lead may be associated with an opportunity, account, or contact.\n * The converted lead itself must be detached from the activity,\n * while the converted prospect objects must be associated instead,\n * since they now represent the state of the deal.\n */\n $activity->setLeadId(null);\n\n /**\n * CRM property \"WhatId\" can be either an Opportunity or an Account.\n * For us a converted Opportunity has higher priority than an Account.\n * An Opportunity carries more concrete data, including a reference to the Account record itself.\n */\n if ($activityLead->hasOpportunity()) {\n $convertedOpportunity = $activityLead->getOpportunity();\n\n $convertedOpportunityId = $convertedOpportunity->getId();\n $convertedAccountId = $convertedOpportunity->getAccountId();\n $stageId = $convertedOpportunity->getStageId();\n $value = $convertedOpportunity->getValue();\n\n $whatId = $convertedOpportunity->getCrmProviderId();\n }\n\n if ($activityLead->hasAccount()) {\n $convertedAccount = $activityLead->getAccount();\n\n $convertedAccountId ??= $convertedAccount->getId();\n\n $whatId ??= $convertedAccount->getCrmProviderId();\n }\n\n /**\n * WhoId can only be a Contact or a Lead.\n * Since we are detaching the Lead, it can only be a Contact for the current activity.\n * It does not conflict with any other object.\n */\n if ($activityLead->hasContact()) {\n $convertedContact = $activityLead->getContact();\n\n $convertedContactId = $convertedContact->getId();\n\n $whoId = $convertedContact->getCrmProviderId();\n }\n\n $activity->setOpportunityId($convertedOpportunityId);\n $activity->setAccountId($convertedAccountId);\n $activity->setContactId($convertedContactId);\n $activity->setStageId($stageId);\n $activity->setValue($value);\n\n $activity->save();\n\n $this->eventDispatcher->dispatch(\n new ActivityLeadConverted($activity, $activityLead)\n );\n\n $this->logger->info('[Salesforce] Lead is converted', [\n 'activity_id' => $activity->getId(),\n 'whoId' => $whoId,\n 'whatId' => $whatId,\n ]);\n\n return [\n 'WhoId' => $whoId,\n 'WhatId' => $whatId,\n ];\n }\n\n private function saveCrmObject(string $objectType, Activity $activity, array $payload): void\n {\n /**\n * Tasks and events have different payload structures,\n * so we need to consider the type of the object we are sending to the CRM\n */\n $specificPayload = $objectType === Field::OBJECT_TASK\n ? $this->payloadBuilder->buildTaskPayload($activity)\n : $this->payloadBuilder->buildEventPayload($activity);\n\n $payload = array_merge($payload, $specificPayload);\n\n if ($activity->hasCrmProviderId()) {\n $this->logger->info('[Salesforce] Updating crm object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n try {\n $this->updateCrmActivity($objectType, $activity, $payload);\n } catch (HttpNotFoundException) {\n $this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $activity->setCrmProviderId(null);\n $activity->save();\n }\n\n return;\n }\n\n $this->logger->info('[Salesforce] Creating CRM object', [\n 'activity_id' => $activity->getId(),\n 'crm_provider_id' => $activity->getCrmProviderId(),\n 'object_type' => $objectType,\n ]);\n\n $crmProviderId = $this->createRecord($objectType, $payload);\n\n $activity->setCrmProviderId($crmProviderId);\n $activity->save();\n }\n\n /**\n * @throws HttpNotFoundException\n */\n private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void\n {\n $sfActivity = $this->getRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n fields: ['Description', 'WhoId', 'WhatId']\n );\n\n if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {\n $this->logger->info('[Salesforce] Updating WhoId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n\n if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {\n $this->logger->info('[Salesforce] Updating WhatId', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n ]);\n } else {\n $payload['WhatId'] = null;\n }\n }\n\n $payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(\n $payload['Description'],\n $sfActivity['Description'] ?? null\n );\n\n $this->logger->info('[Salesforce] Updating CRM activity data', [\n 'objectType' => $objectType,\n 'activityId' => $activity->getUuid(),\n 'crmActivity' => $sfActivity,\n 'payload' => $payload,\n ]);\n\n $this->updateRecord(\n objectType: $objectType,\n objectId: $activity->getCrmProviderId(),\n data: $payload\n );\n }\n\n protected function getActivityDecorator(): DecorateActivity\n {\n if ($this->decorateActivity === null) {\n $this->decorateActivity = app(DecorateActivity::class);\n }\n\n return $this->decorateActivity;\n }\n\n private function resetLeadAssociation(Activity $activity): void\n {\n $activity->setStageId(null);\n $activity->setLeadId(null);\n $activity->save();\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.85486114,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.87291664,"top":0.31,"width":0.018055556,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.9138889,"top":0.31,"width":0.059027776,"height":0.026666667},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"8","depth":4,"bounds":{"left":0.8645833,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.8854167,"top":0.34444445,"width":0.015277778,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.9048611,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.92569447,"top":0.34444445,"width":0.016666668,"height":0.02111111},"on_screen":true,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.9458333,"top":0.3422222,"width":0.015277778,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.9611111,"top":0.3422222,"width":0.014583333,"height":0.025555555},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","depth":4,"on_screen":true,"value":"SELECT\n# DISTINCT\nopp.id as opp_id, opp.uuid, opp.name,\n# COUNT(dr.id) AS deal_risk_count,\n\n# dr.id,\n# cfd.value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\n# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id\n# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id\n\nLEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 1\nAND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\nGROUP BY opp.id, cfd.value\nORDER BY\n# cfd.value\n CAST(cfd.value AS UNSIGNED)\n# owner_name\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1\n# AND gdrt.is_enabled = 1)\nDESC\nLIMIT 25\n# OFFSET 0\n;\n\nselect * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';\nselect * from crm_layout_entities where crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4584045;\nSELECT * FROM crm_field_data WHERE object_id = 4584045;\n\nSELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'\n\nSELECT\n opp.id as opportunity_id,\n opp.name,\n COUNT(dr.id) as risk_count\nFROM opportunities opp\nLEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id\nWHERE opp.id IN (\n 6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788\n)\nGROUP BY opp.id;\n\nSELECT COUNT(dr.id)\n FROM deal_risks dr\n JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n WHERE dr.opportunity_id = 5563344\n# AND gdrt.group_id = usr.group_id\n\n\n\nEXPLAIN SELECT\n opp.id as opp_id, opp.uuid, opp.name,\n\ncfd.value,\ncfv.sequence,\ncfv.value,\n# MAX(cfd.value) AS max_cfd_value,\nusr.name AS owner_name,\nopp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,\nusr.uuid as owner_uuid,\nusr.photo_path as owner_photo,\nusr.id AS owner_id,\njt.name as owner_job,\nopp.stage_id, opp.stage_updated_at,\nacc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,\nrt.business_process_id AS pipeline_id\nFROM opportunities opp\n\nLEFT JOIN record_types rt ON opp.record_type_id = rt.id\nLEFT JOIN users usr ON opp.user_id = usr.id\nLEFT JOIN accounts acc ON opp.account_id = acc.id\nLEFT JOIN job_titles jt ON usr.job_title_id = jt.id\n\nLEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id\n FROM crm_field_data sub_cfd\n WHERE sub_cfd.object_id = opp.id\n AND sub_cfd.crm_field_id = 66810\n ORDER BY sub_cfd.updated_at DESC\n LIMIT 1)\n\nLEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value\n\nWHERE opp.user_id IS NOT NULL\nAND opp.deleted_at IS NULL\nAND opp.is_closed = 0\n# AND opp.is_closed = 1\n# AND opp.is_won = 0\nAND opp.close_date >= '2024-01-01 00:00:00'\nAND opp.close_date <= '2024-12-31 23:59:59'\nAND usr.team_id = 1\n\n# and opp.id = 4823179\n\n# GROUP BY opp.id\nORDER BY\n cfv.sequence DESC,\n# opp.name\n# owner_name\n cfd.value\n# CAST(cfd.value AS UNSIGNED)\n# CAST(MAX(cfd.value) AS UNSIGNED)\n# (SELECT COUNT(dr.id)\n# FROM deal_risks dr\n# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id\n# WHERE dr.opportunity_id = opp.id\n# AND dr.is_active = 1 AND gdrt.is_enabled = 1)\nDESC\n# LIMIT 75, 25\n;\n\n\n\nSELECT * FROM crm_field_values WHERE crm_field_id = 66810;\n\nSELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at\nFROM crm_fields f\nINNER JOIN crm_field_data fd ON fd.crm_field_id = f.id\n WHERE (f.crm_configuration_id = 1)\n AND (f.object_type = 'opportunity')\n# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))\n AND (fd.object_id IN (4158460))\n AND (f.crm_provider_id IN ('ForecastCategoryName'))\n ORDER BY fd.object_id ASC, fd.updated_at DESC;\n\nselect * from crm_layouts where crm_configuration_id = 1;\nselect cf.* from crm_fields cf\njoin crm_layout_entities cle on cf.id = cle.crm_field_id\nwhere crm_layout_id = 1493;\n\nSELECT * FROM opportunities WHERE id = 4158460;\nSELECT * FROM crm_field_data WHERE object_id = 4158460;\n\nselect * from users where team_id = 1;\nSELECT * FROM users WHERE id = 7160;\nselect * from role_user where user_id = 3248;\n\nselect * from crm_field_values where crm_field_id = 66824;\n\nSELECT * FROM users WHERE id = 23470;\nselect * from crm_configurations;\n\n# ******************************************\nselect * from teams where id = 1038; # 23521, 966\nselect * from users where team_id = 1038;\nselect * from crm_configurations where id = 966;\nSELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762\nSELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764\nSELECT * FROM participants WHERE activity_id = 54965764;\n\nSELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075\nSELECT * FROM participants WHERE activity_id = 54964075;\nselect f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id\n where tf.team_id = 1038;\n\n\n# ****************************************** PD *************************\nselect * from teams where id = 1029;\nSELECT * FROM crm_configurations WHERE id = 957;\nSELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421\n\n# ****************************************** Close *************************\nselect * from teams where id = 1031;\nSELECT * FROM crm_configurations WHERE id = 959;\nSELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517\n\n\nSELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433\n\nSELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009\n\n# ****************************************** SF *************************\nSELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;\n\nselect * from roles;\nselect * from permissions;\nselect * from permission_role where permission_id = 136;\n\nselect * from migrations order by id desc;\n\nselect * from teams where id IN (1, 1037);\nselect * from crm_layouts where crm_configuration_id = 1;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;\nSELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);\n\nselect * from features;\nselect * from team_features where feature_id = 33;\nselect * from opportunities;\n\nselect * from teams;\nSELECT\n CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,\n u.email,\n sa.*,\n t.owner_id FROM social_accounts sa\nJOIN users u on u.id = sa.sociable_id\nJOIN teams t on t.id = u.team_id\nWHERE u.team_id = 1052 and sa.provider = 'hubspot';\n\nSELECT * FROM accounts where id = 11512582;\nselect * from activities where account_id = 11512582;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"on_screen":false,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.025,"top":0.06666667,"width":0.050694443,"height":0.034444444},"on_screen":true,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"on_screen":false,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
9077963656576291944
|
5299220392384270933
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#12066 on JY-20725-handle Project: faVsco.js, menu
#12066 on JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
HandleHubspotRateLimitTest
Run 'HandleHubspotRateLimitTest'
Debug 'HandleHubspotRateLimitTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
6
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Salesforce\ServiceTraits;
use Illuminate\Events\Dispatcher;
use Jiminny\Events\Activities\Crm\ActivityLeadConverted;
use Jiminny\Exceptions\HttpNotFoundException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Models\Activity;
use Jiminny\Models\Crm\Configuration;
use Jiminny\Models\Crm\Field;
use Jiminny\Models\Crm\Profile;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Lead;
use Jiminny\Models\Playbook;
use Jiminny\Models\PlaybookCategory;
use Jiminny\Services\Crm\Helpers\CrmHelperRepository;
use Jiminny\Services\Crm\Salesforce\DecorateActivity;
use Jiminny\Services\Crm\Salesforce\PayloadBuilder;
use Psr\Log\LoggerInterface;
trait LogActivityTrait
{
public ?Configuration $config;
public ?Profile $profile;
protected PayloadBuilder $payloadBuilder;
protected LoggerInterface $logger;
protected Dispatcher $eventDispatcher;
protected CrmHelperRepository $crmHelperRepository;
protected ?DecorateActivity $decorateActivity = null;
abstract public function getPlaybookFromActivity(Activity $activity): ?Playbook;
abstract public function matchesCrmType(PlaybookCategory $category): bool;
abstract public function syncLead(string $crmId): ?Lead;
abstract public function getRecord(string $objectType, string $objectId, array $fields = []): array;
abstract public function createRecord(string $objectType, array $data): string;
abstract public function updateRecord(string $objectType, string $objectId, array $data, array $headers = []): void;
/**
* Save an activity, update CRM prospect objects
*
* Create or update a task or event (depending on most applicable playbook)
*/
public function saveActivity(Activity $activity): Activity
{
$playbook = $this->getPlaybookFromActivity($activity);
if ($playbook === null) {
throw new InvalidArgumentException('Please configure a Playbook first.');
}
$this->logger->info('[Salesforce] Log activity', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
]);
$payload = [
'OwnerId' => $this->profile->getCrmProviderId(),
'Description' => $this->getActivityDecorator()->generateDescription($activity),
];
$payload += $this->buildSubjectPayload($activity, $playbook);
$payload += $this->buildProspectPayload($activity);
$crmObjectType = $playbook->getActivityType() === Playbook::ACTIVITY_TYPE_TASK
? Field::OBJECT_TASK
: Field::OBJECT_EVENT;
$this->logger->info('[Salesforce] Log activity. Payload Prepared', [
'activity_id' => $activity->getId(),
'object_type' => $playbook->getActivityType(),
'crm_object_type' => $crmObjectType,
'payload' => $payload,
]);
$this->saveCrmObject($crmObjectType, $activity, $payload);
return $activity;
}
private function buildSubjectPayload(Activity $activity, Playbook $playbook): array
{
if ($this->matchesCrmType($activity->getCategory())) {
/**
* If the activity playbook category name (i.e. activity type) matches a known activity type that exists
* in the CRM, then we set the activity type in the payload.
* Some activity types may be locally created. They shouldn't be sent to Salesforce.
*
* The resulting payload attribute will look like:
* `Type` => 'Cold Call'
*/
return [
/** ActivityFieldID => ActivityType */
$playbook->getActivityField()->getCrmProviderId() => $activity->getCategory()->getName(),
'Subject' => $this->getActivityDecorator()->generateTitle($activity),
];
}
/**
* Building of the title seems very inconsistent
* Subject here will be something like:
* "Local activity type: Activity Title"
*/
$subject = $activity->getCategory()->getName();
if ($activity->getTitle() !== null) {
$subject .= ': ' . $activity->getTitle();
}
return ['Subject' => $subject];
}
private function buildProspectPayload(Activity $activity): array
{
$payload = [];
if ($activity->getAccountId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'account_id' => $activity->getAccountId(),
'opportunity_id' => $activity->getOpportunityId(),
'contact_id' => $activity->getContactId(),
]);
$hasLinkFeature = $this->crmHelperRepository->hasFeature(
$activity,
FeatureEnum::LINK_ACTIVITY_TO_MULTIPLE_PROSPECTS
);
if (($hasLinkFeature && $activity->getOpportunityId() && ! $activity->getContactId())
|| (! $hasLinkFeature && $activity->getOpportunityId())
) {
$payload['WhatId'] = $activity->getOpportunity()->getCrmProviderId();
} else {
$payload['WhatId'] = $activity->getAccount()->getCrmProviderId();
}
}
if ($activity->getContactId()) {
$this->logger->info('[Salesforce] Activity has account id', [
'activity_id' => $activity->getId(),
'contact_id' => $activity->getContactId(),
]);
$payload['WhoId'] = $activity->getContact()->getCrmProviderId();
} elseif ($activity->getLeadId()) {
$this->logger->info('[Salesforce] Activity has lead id', [
'activity_id' => $activity->getId(),
'lead_id' => $activity->getLeadId(),
]);
/**
* An activity may have:
* a) a contact | account | opportunity (or combinations)
* b) only a lead
* c) none of the above
*
* An activity should not have a lead, and another prospect object at the same time.
*
* This logical flow should not happen naturally, but as a fallback: if an activity has both
* a Lead and an Account, the account's WhatId takes precedence in the CRM payload.
* The lead association will be detached locally, but the account WhatId is preserved in Salesforce.
*/
$payload += $this->handleActivityLead($activity);
}
return $payload;
}
private function handleActivityLead(Activity $activity): array
{
$this->logger->info('[Salesforce] Activity sync lead', [
'activity_id' => $activity->getId(),
]);
/**
* Sync lead to pull fresh data. Leads change often,
* they may get 'converted', and we must handle the new state accordingly
*/
try {
$activityLead = $this->syncLead(
$activity->getLead()->getCrmProviderId()
);
} catch (HttpNotFoundException) {
$this->logger->warning('[Salesforce] Activity lead is missing in Salesforce. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not found, maybe it's remotely deleted
*/
$this->resetLeadAssociation($activity);
return [];
}
if ($activityLead === null) {
$this->logger->warning('[Salesforce] Activity lead is missing in local DB. Resetting lead', [
'activity_id' => $activity->getId(),
]);
/**
* Lead is not loaded, for some reason. It may be remotely found, but locally deleted.
* Or an important Lead property may be missing, and it cannot be fully imported.
*/
$this->resetLeadAssociation($activity);
return [];
}
/**
* The lead is not converted, directly use it as WhoId and move on.
*/
if ($activityLead->getConvertedAt() === null) {
return [
'WhoId' => $activity->getLead()->getCrmProviderId(),
'WhatId' => null, // Clears WhatId on the remote record, unless an account WhatId was already set in the payload.
];
}
/**
* Task/Event payload properties for the CRM update
*/
$whoId = null;
$whatId = null;
/**
* Activity payload properties, that need to be updated.
*/
$convertedOpportunityId = null;
$convertedAccountId = null;
$convertedContactId = null;
$value = null;
/**
* If there is converted opportunity, it will update the activity stage.
* If there isn't an opportunity, a converted account/contact cannot have a stage id,
* so the activity shouldn't have a stage either.
*/
$stageId = null;
/**
* The lead is definitely converted.
* This means the lead may be associated with an opportunity, account, or contact.
* The converted lead itself must be detached from the activity,
* while the converted prospect objects must be associated instead,
* since they now represent the state of the deal.
*/
$activity->setLeadId(null);
/**
* CRM property "WhatId" can be either an Opportunity or an Account.
* For us a converted Opportunity has higher priority than an Account.
* An Opportunity carries more concrete data, including a reference to the Account record itself.
*/
if ($activityLead->hasOpportunity()) {
$convertedOpportunity = $activityLead->getOpportunity();
$convertedOpportunityId = $convertedOpportunity->getId();
$convertedAccountId = $convertedOpportunity->getAccountId();
$stageId = $convertedOpportunity->getStageId();
$value = $convertedOpportunity->getValue();
$whatId = $convertedOpportunity->getCrmProviderId();
}
if ($activityLead->hasAccount()) {
$convertedAccount = $activityLead->getAccount();
$convertedAccountId ??= $convertedAccount->getId();
$whatId ??= $convertedAccount->getCrmProviderId();
}
/**
* WhoId can only be a Contact or a Lead.
* Since we are detaching the Lead, it can only be a Contact for the current activity.
* It does not conflict with any other object.
*/
if ($activityLead->hasContact()) {
$convertedContact = $activityLead->getContact();
$convertedContactId = $convertedContact->getId();
$whoId = $convertedContact->getCrmProviderId();
}
$activity->setOpportunityId($convertedOpportunityId);
$activity->setAccountId($convertedAccountId);
$activity->setContactId($convertedContactId);
$activity->setStageId($stageId);
$activity->setValue($value);
$activity->save();
$this->eventDispatcher->dispatch(
new ActivityLeadConverted($activity, $activityLead)
);
$this->logger->info('[Salesforce] Lead is converted', [
'activity_id' => $activity->getId(),
'whoId' => $whoId,
'whatId' => $whatId,
]);
return [
'WhoId' => $whoId,
'WhatId' => $whatId,
];
}
private function saveCrmObject(string $objectType, Activity $activity, array $payload): void
{
/**
* Tasks and events have different payload structures,
* so we need to consider the type of the object we are sending to the CRM
*/
$specificPayload = $objectType === Field::OBJECT_TASK
? $this->payloadBuilder->buildTaskPayload($activity)
: $this->payloadBuilder->buildEventPayload($activity);
$payload = array_merge($payload, $specificPayload);
if ($activity->hasCrmProviderId()) {
$this->logger->info('[Salesforce] Updating crm object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
try {
$this->updateCrmActivity($objectType, $activity, $payload);
} catch (HttpNotFoundException) {
$this->logger->error('[Salesforce] Target crm object is missing in the crm. Resetting crm provider id', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$activity->setCrmProviderId(null);
$activity->save();
}
return;
}
$this->logger->info('[Salesforce] Creating CRM object', [
'activity_id' => $activity->getId(),
'crm_provider_id' => $activity->getCrmProviderId(),
'object_type' => $objectType,
]);
$crmProviderId = $this->createRecord($objectType, $payload);
$activity->setCrmProviderId($crmProviderId);
$activity->save();
}
/**
* @throws HttpNotFoundException
*/
private function updateCrmActivity(string $objectType, Activity $activity, array $payload): void
{
$sfActivity = $this->getRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
fields: ['Description', 'WhoId', 'WhatId']
);
if (! empty($payload['WhoId']) && $sfActivity['WhoId'] !== $payload['WhoId']) {
$this->logger->info('[Salesforce] Updating WhoId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
if (! empty($payload['WhatId']) && $sfActivity['WhatId'] !== $payload['WhatId']) {
$this->logger->info('[Salesforce] Updating WhatId', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
]);
} else {
$payload['WhatId'] = null;
}
}
$payload['Description'] = $this->getActivityDecorator()->mergeDescriptions(
$payload['Description'],
$sfActivity['Description'] ?? null
);
$this->logger->info('[Salesforce] Updating CRM activity data', [
'objectType' => $objectType,
'activityId' => $activity->getUuid(),
'crmActivity' => $sfActivity,
'payload' => $payload,
]);
$this->updateRecord(
objectType: $objectType,
objectId: $activity->getCrmProviderId(),
data: $payload
);
}
protected function getActivityDecorator(): DecorateActivity
{
if ($this->decorateActivity === null) {
$this->decorateActivity = app(DecorateActivity::class);
}
return $this->decorateActivity;
}
private function resetLeadAssociation(Activity $activity): void
{
$activity->setStageId(null);
$activity->setLeadId(null);
$activity->save();
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
8
1
3
4
Previous Highlighted Error
Next Highlighted Error
SELECT
# DISTINCT
opp.id as opp_id, opp.uuid, opp.name,
# COUNT(dr.id) AS deal_risk_count,
# dr.id,
# cfd.value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
# LEFT JOIN group_deal_risk_types gdrt ON gdrt.group_id = usr.group_id
# LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id AND dr.group_deal_risk_type_id = gdrt.id
LEFT JOIN crm_field_data cfd ON (cfd.object_id = opp.id and cfd.crm_field_id = 66814)
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 1
AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
GROUP BY opp.id, cfd.value
ORDER BY
# cfd.value
CAST(cfd.value AS UNSIGNED)
# owner_name
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1
# AND gdrt.is_enabled = 1)
DESC
LIMIT 25
# OFFSET 0
;
select * from crm_fields where crm_configuration_id = 1 and object_type = 'opportunity';
select * from crm_layout_entities where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4584045;
SELECT * FROM crm_field_data WHERE object_id = 4584045;
SELECT * FROM opportunities where team_id = 1 and crm_provider_id = '0061K00000lfb9IQAQ'
SELECT
opp.id as opportunity_id,
opp.name,
COUNT(dr.id) as risk_count
FROM opportunities opp
LEFT JOIN deal_risks dr ON dr.opportunity_id = opp.id
WHERE opp.id IN (
6069574,8900938,9507638,9524799,9660490,9662824,9705675,9749758,4158460,4391812,6450439,4448422,5118945,5590675,4584045,7228149,9002408,9165534,9446720,9641778,9665149,9703344,9709280,5747948,4158491,6182565,6263970,5798120,5111315,4536978,6062352,6548383,6072095,6548225,4480986,5011422,6548381,8760540,8917554,9509986,9514392,9569009,9569011,9578490,9713604,5784397,7276612,7288405,8994421,9118219,9608148,9818911,4510535,6479693,5958049,6271674,6550448,4158331,4158483,6126571,6171615,6540943,4897466,5190896,5796182,5932762,8572433,8723698,8892697,9711001,9789264,4549188,6100831,6170064,6260799,6263653,6449936,6530871,6538978,7777651,8059269,8319918,8787049,8901150,9263153,9453207,9514738,9696700,9791062,5752018,6421452,7439134,7878923,9354763,9369285,9514396,9582506,9889949,9890216,4094311,4158495,4158496,6098128,5585661,3872564,6442149,5891604,6164746,6199593,6583474,6519684,9018490,9809006,4496897,5041324,5829430,6198319,6253504,6555763,7242914,7931055,8024125,8797814,8058559,8673347,8892695,8994420,9616219,9714970,9722004,9809439,9818918,6523177,8134147,9002915,9711422,9892713,9901719,9954210,9978435,5800810,6243518,6416114,6222251,6411974,6512456,5791953,6545606,9914780,5805540,6238986,6463838,6547680,9767049,9809437,9810885,9890855,6673493,9902036,4335521,6379871,6503799,6546077,8018765,9907556,9958433,9905855,9916179,9946741,9957877,5563344,6271838,6450815,7641128,7762567,7780592,8684810,8685786,8685787,8685788
)
GROUP BY opp.id;
SELECT COUNT(dr.id)
FROM deal_risks dr
JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
WHERE dr.opportunity_id = 5563344
# AND gdrt.group_id = usr.group_id
EXPLAIN SELECT
opp.id as opp_id, opp.uuid, opp.name,
cfd.value,
cfv.sequence,
cfv.value,
# MAX(cfd.value) AS max_cfd_value,
usr.name AS owner_name,
opp.value, opp.currency_code, opp.close_date, opp.remotely_created_at, opp.is_closed, opp.is_won,
usr.uuid as owner_uuid,
usr.photo_path as owner_photo,
usr.id AS owner_id,
jt.name as owner_job,
opp.stage_id, opp.stage_updated_at,
acc.name AS acc_name, opp.stage_updated_at, acc.crm_provider_id AS acc_provider_id, opp.crm_provider_id AS opp_provider_id,
rt.business_process_id AS pipeline_id
FROM opportunities opp
LEFT JOIN record_types rt ON opp.record_type_id = rt.id
LEFT JOIN users usr ON opp.user_id = usr.id
LEFT JOIN accounts acc ON opp.account_id = acc.id
LEFT JOIN job_titles jt ON usr.job_title_id = jt.id
LEFT JOIN crm_field_data cfd ON cfd.id = (SELECT sub_cfd.id
FROM crm_field_data sub_cfd
WHERE sub_cfd.object_id = opp.id
AND sub_cfd.crm_field_id = 66810
ORDER BY sub_cfd.updated_at DESC
LIMIT 1)
LEFT JOIN crm_field_values cfv ON cfv.crm_field_id = 66810 AND cfv.value = cfd.value
WHERE opp.user_id IS NOT NULL
AND opp.deleted_at IS NULL
AND opp.is_closed = 0
# AND opp.is_closed = 1
# AND opp.is_won = 0
AND opp.close_date >= '2024-01-01 00:00:00'
AND opp.close_date <= '2024-12-31 23:59:59'
AND usr.team_id = 1
# and opp.id = 4823179
# GROUP BY opp.id
ORDER BY
cfv.sequence DESC,
# opp.name
# owner_name
cfd.value
# CAST(cfd.value AS UNSIGNED)
# CAST(MAX(cfd.value) AS UNSIGNED)
# (SELECT COUNT(dr.id)
# FROM deal_risks dr
# JOIN group_deal_risk_types gdrt ON dr.group_deal_risk_type_id = gdrt.id
# WHERE dr.opportunity_id = opp.id
# AND dr.is_active = 1 AND gdrt.is_enabled = 1)
DESC
# LIMIT 75, 25
;
SELECT * FROM crm_field_values WHERE crm_field_id = 66810;
SELECT f.id, f.crm_provider_id AS field_name, f.label, fd.object_id AS dealId, fd.value, fd.updated_at, fd.id, fd.created_at
FROM crm_fields f
INNER JOIN crm_field_data fd ON fd.crm_field_id = f.id
WHERE (f.crm_configuration_id = 1)
AND (f.object_type = 'opportunity')
# AND (fd.object_id IN (4158331,4158483,4158495,4158496,6069574,6263970,6171615,6540943,6545606,5829430,6198319,6263653,6548381,7242914,8797814,7228149,7439134,7878923,8134147,9002915,9118219,9165534,9354763,9369285,9446720))
AND (fd.object_id IN (4158460))
AND (f.crm_provider_id IN ('ForecastCategoryName'))
ORDER BY fd.object_id ASC, fd.updated_at DESC;
select * from crm_layouts where crm_configuration_id = 1;
select cf.* from crm_fields cf
join crm_layout_entities cle on cf.id = cle.crm_field_id
where crm_layout_id = 1493;
SELECT * FROM opportunities WHERE id = 4158460;
SELECT * FROM crm_field_data WHERE object_id = 4158460;
select * from users where team_id = 1;
SELECT * FROM users WHERE id = 7160;
select * from role_user where user_id = 3248;
select * from crm_field_values where crm_field_id = 66824;
SELECT * FROM users WHERE id = 23470;
select * from crm_configurations;
# [PASSWORD_DOTS]
select * from teams where id = 1038; # 23521, 966
select * from users where team_id = 1038;
select * from crm_configurations where id = 966;
SELECT * FROM activities WHERE uuid_to_bin('e8dc7c34-31f6-4430-bd81-2d9d8f00dd07') = uuid; # 54965762
SELECT * FROM activities WHERE uuid_to_bin('4b5727c0-69d1-428f-b8d9-b649055166e2') = uuid; # 54965764
SELECT * FROM participants WHERE activity_id = 54965764;
SELECT id, uuid, title, recording_state FROM activities WHERE uuid_to_bin('355f105d-5606-4379-b0c5-d91daf59f4ce') = uuid; # 54964075
SELECT * FROM participants WHERE activity_id = 54964075;
select f.id, slug, title, tf.team_id from team_features tf JOIN features f on tf.feature_id = f.id
where tf.team_id = 1038;
# [PASSWORD_DOTS] PD [PASSWORD_DOTS]
select * from teams where id = 1029;
SELECT * FROM crm_configurations WHERE id = 957;
SELECT * FROM activities WHERE uuid_to_bin('581a33cb-4343-44bd-ac0c-4a5cee71c5ec') = uuid; # 54963423
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('8b6bb2f7-e7a7-4aec-8806-fbfea7093ccd') = uuid; # 54963421
# [PASSWORD_DOTS] Close [PASSWORD_DOTS]
select * from teams where id = 1031;
SELECT * FROM crm_configurations WHERE id = 959;
SELECT * FROM activities WHERE uuid_to_bin('59c517e0-96c9-4dad-bfeb-b7bef72f8725') = uuid; # 54963517
SELECT * FROM activities WHERE uuid_to_bin('07238011-25fa-418e-838b-fb21e82b9ea2') = uuid; # 54963433
SELECT * FROM activities WHERE uuid_to_bin('d68311e3-ac34-49bd-bf04-88323a7e5352') = uuid; # 54966009
# [PASSWORD_DOTS] SF [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('2bd4cfa3-4eb5-4c77-84a7-9ed46a21c988') = uuid;
select * from roles;
select * from permissions;
select * from permission_role where permission_id = 136;
select * from migrations order by id desc;
select * from teams where id IN (1, 1037);
select * from crm_layouts where crm_configuration_id = 1;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 1493;
SELECT * FROM crm_fields WHERE id IN (1652,1661,66799,66814,66821,66836,66843,66846,66864,84752,182306,323580,380378);
select * from features;
select * from team_features where feature_id = 33;
select * from opportunities;
select * from teams;
SELECT
CONCAT(u.id, CASE WHEN u.id = t.owner_id THEN ' (owner)' ELSE '' END) AS user_id,
u.email,
sa.*,
t.owner_id FROM social_accounts sa
JOIN users u on u.id = sa.sociable_id
JOIN teams t on t.id = u.team_id
WHERE u.team_id = 1052 and sa.provider = 'hubspot';
SELECT * FROM accounts where id = 11512582;
select * from activities where account_id = 11512582;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
NULL
|
NULL
|
NULL
|