* Resolves the effective object type from the subblock store. `getValue` returns `null` * for fields the user hasn't interacted with yet, so we fall back to the dropdown's * default ('contact') — otherwise the cascading property selectors render empty on * first render even when the dropdown visi
(blockId: string)
| 21 | * first render even when the dropdown visibly shows "contact". |
| 22 | */ |
| 23 | function resolveSelectedObjectType(blockId: string): string | null { |
| 24 | const objectType = useSubBlockStore.getState().getValue(blockId, 'objectType') as string | null |
| 25 | const customId = useSubBlockStore.getState().getValue(blockId, 'customObjectTypeId') as |
| 26 | | string |
| 27 | | null |
| 28 | const selected = objectType ?? 'contact' |
| 29 | if (selected === 'custom') { |
| 30 | const trimmed = customId?.trim() |
| 31 | return trimmed ? trimmed : null |
| 32 | } |
| 33 | return selected |
| 34 | } |
| 35 | |
| 36 | async function fetchHubSpotProperties(blockId: string, objectType: string) { |
| 37 | const credentialId = useSubBlockStore.getState().getValue(blockId, 'triggerCredentials') as |