Initial commit

This commit is contained in:
gustavooth
2026-07-23 22:56:30 -03:00
commit 22a1006598
1816 changed files with 410742 additions and 0 deletions
@@ -0,0 +1,51 @@
<?php
namespace FluentCrm\App\Services\ExternalIntegrations\Oxygen;
use FluentCrm\App\Models\Tag;
class ConditionBuilder
{
public function init()
{
$tags = Tag::get();
$formattedTags = [];
foreach ($tags as $tag) {
$formattedTags[] = $tag->slug;
}
oxygen_vsb_register_condition(
'FluentCRM - Contact Tag',
array(
'options' => $formattedTags,
'custom' => false
),
array('exist', 'not exist'),
'fcrmOxyCheckTagCondition',
'FluentCRM'
);
oxygen_vsb_register_condition(
'FluentCRM - Contact Status',
array(
'options' => ['subscribed', 'pending', 'unsubscribed'],
'custom' => false
),
array('=', '!='),
'fcrmOxyCheckStatusCondition',
'FluentCRM'
);
oxygen_vsb_register_condition(
'FluentCRM - Contact Exist',
array(
'options' => ['yes', 'no'],
'custom' => false
),
array('='),
'fcrmOxyCheckContactExistCondition',
'FluentCRM'
);
}
}
@@ -0,0 +1,69 @@
<?php
(new \FluentCrm\App\Services\ExternalIntegrations\Oxygen\ConditionBuilder())->init();
function fcrmOxyCheckTagCondition($value, $operator)
{
$contactApi = FluentCrmApi('contacts');
$contact = $contactApi->getCurrentContact(true, true);
if(!$contact) {
if($operator == 'exist') {
return false;
} else {
return true;
}
}
$contactTags = $contact->tags;
if($operator == 'exist') {
foreach ($contactTags as $tag) {
if($tag->slug == $value) {
return true;
}
}
return false;
}
foreach ($contactTags as $tag) {
if($tag->slug == $value) {
return false;
}
}
return true;
}
function fcrmOxyCheckStatusCondition($value, $operator)
{
$contactApi = FluentCrmApi('contacts');
$contact = $contactApi->getCurrentContact(true, true);
if(!$contact) {
if($operator == '=') {
return false;
} else {
return true;
}
}
if($operator == '=') {
return $contact->status == $value;
}
return $contact->status != $value;
}
function fcrmOxyCheckContactExistCondition($value, $operator)
{
$contactApi = FluentCrmApi('contacts');
$contact = $contactApi->getCurrentContact(true, true);
if($value == 'yes') {
return !!$contact;
}
return !$contact;
}