Skip to content

Commit 93b77a4

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(plaid): preserve institution country context
1 parent 71700f3 commit 93b77a4

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

apps/sim/blocks/blocks/plaid.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const PlaidBlock: BlockConfig<PlaidResponse> = {
133133
serviceId: 'plaid',
134134
canonicalParamId: 'institutionId',
135135
placeholder: 'Search Plaid institutions',
136-
dependsOn: ['credential'],
136+
dependsOn: ['credential', 'countryCodes'],
137137
mode: 'basic',
138138
condition: {
139139
field: 'operation',
@@ -167,6 +167,7 @@ export const PlaidBlock: BlockConfig<PlaidResponse> = {
167167
title: 'Country Codes',
168168
type: 'short-input',
169169
placeholder: 'Comma-separated, defaults to US',
170+
value: () => 'US',
170171
mode: 'advanced',
171172
condition: {
172173
field: 'operation',

apps/sim/tools/plaid/plaid.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,16 @@ describe('PlaidBlock tools.config.params', () => {
155155
).toMatchObject({
156156
selectorKey: 'plaid.institutions',
157157
canonicalParamId: 'institutionId',
158-
dependsOn: ['credential'],
158+
dependsOn: ['credential', 'countryCodes'],
159159
})
160160
expect(
161161
PlaidBlock.subBlocks.find((subBlock) => subBlock.id === 'manualInstitutionId')
162162
).toMatchObject({ canonicalParamId: 'institutionId', mode: 'advanced' })
163+
const countryCodes = PlaidBlock.subBlocks.find((subBlock) => subBlock.id === 'countryCodes')
164+
expect(typeof countryCodes?.value).toBe('function')
165+
expect(typeof countryCodes?.value === 'function' ? countryCodes.value({}) : undefined).toBe(
166+
'US'
167+
)
163168
expect(PlaidBlock.inputs).toHaveProperty('oauthCredential')
164169
expect(PlaidBlock.inputs).toHaveProperty('authAccountIds')
165170
expect(PlaidBlock.inputs).not.toHaveProperty('plaidCredentialId')

0 commit comments

Comments
 (0)