Skip to content

Commit c147b4c

Browse files
committed
feat: bento event module custom field key added
1 parent 2277f5f commit c147b4c

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

frontend-dev/src/components/AllIntegrations/Bento/BentoFieldMap.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { SmartTagField } from '../../../Utils/StaticData/SmartTagField'
55
import { __ } from '../../../Utils/i18nwrap'
66
import TagifyInput from '../../Utilities/TagifyInput'
77
import { addFieldMap, delFieldMap, handleCustomValue, handleFieldMapping } from './IntegrationHelpers'
8+
import CustomFieldKey from '../../Utilities/CustomFieldKey'
89

910
export default function BentoFieldMap({ i, formFields, field, bentoConf, setBentoConf }) {
1011
const requiredFields =
@@ -14,7 +15,7 @@ export default function BentoFieldMap({ i, formFields, field, bentoConf, setBent
1415

1516
const btcbi = useRecoilValue($btcbi)
1617
const { isPro } = btcbi
17-
18+
console.log(bentoConf)
1819
return (
1920
<div className="flx mt-2 mb-2 btcbi-field-map">
2021
<div className="pos-rel flx">
@@ -77,7 +78,21 @@ export default function BentoFieldMap({ i, formFields, field, bentoConf, setBent
7778
</option>
7879
))
7980
)}
81+
{bentoConf.action === 'add_event' && (
82+
<option value="customFieldKey">{__('Custom Field', 'bit-integrations')}</option>
83+
)}
8084
</select>
85+
{field.bentoFormField === 'customFieldKey' && (
86+
<CustomFieldKey
87+
field={field}
88+
index={i}
89+
conf={bentoConf}
90+
setConf={setBentoConf}
91+
fieldValue="customFieldKey"
92+
fieldLabel="Custom Field Key"
93+
className="ml-2"
94+
/>
95+
)}
8196
</div>
8297
{i >= requiredFields.length && (
8398
<>

frontend-dev/src/components/AllIntegrations/Bento/BentoIntegLayout.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ export default function BentoIntegLayout({
118118
<br />
119119
<br />
120120

121-
{!isPro && (
122-
<Note note={`<p>${__('Custom Fields Available in Pro', 'bit-integrations')}</p>`} />
123-
)}
121+
{!isPro &&
122+
bentoConf.action ===
123+
'add_people'(
124+
<Note note={`<p>${__('Custom Fields Available in Pro', 'bit-integrations')}</p>`} />
125+
)}
124126

125127
<div className="mt-4">
126128
<b className="wdt-100">{__('Utilities', 'bit-integrations')}</b>

includes/Actions/Bento/RecordApiHelper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ public function generateReqDataFromFieldMap($data, $fieldMap)
107107
{
108108
$dataFinal = [];
109109
foreach ($fieldMap as $value) {
110-
$triggerValue = $value->formField;
111-
$actionValue = $value->bentoFormField;
112-
$dataFinal[$actionValue] = ($triggerValue === 'custom' && !empty($value->customValue)) ? Common::replaceFieldWithValue($value->customValue, $data) : $data[$triggerValue];
110+
$triggerValue = ($value->formField === 'custom' && !empty($value->customValue)) ? Common::replaceFieldWithValue($value->customValue, $data) : $data[$value->formField];
111+
$actionValue = $value->bentoFormField === 'customFieldKey' && !empty($value->customFieldKey) ? $value->customFieldKey : $value->bentoFormField;
112+
113+
$dataFinal[$actionValue] = $triggerValue;
113114
}
114115

115116
return $dataFinal;

0 commit comments

Comments
 (0)