@@ -21,6 +21,7 @@ import {
21
21
getEntryKlaviyoFieldMappings ,
22
22
setEntryKlaviyoFieldMappings ,
23
23
} from '../utils/field-mappings' ;
24
+ import { getOrgIdForSdk } from '../utils/sdk-helpers' ;
24
25
25
26
// Helper to ensure klaviyoFieldMappings entry exists
26
27
const ensureKlaviyoFieldMappingsEntry = async ( sdk : ConfigAppSDK ) => {
@@ -138,6 +139,7 @@ const ConfigScreen = () => {
138
139
const [ isDisconnecting , setIsDisconnecting ] = useState ( false ) ;
139
140
const popupWindowRef = useRef < Window | null > ( null ) ;
140
141
const checkWindowIntervalRef = useRef < number | null > ( null ) ;
142
+ const orgId = getOrgIdForSdk ( sdk ) ;
141
143
142
144
// Check Klaviyo connection status with polling to handle race conditions
143
145
const checkKlaviyoStatus = async (
@@ -150,7 +152,7 @@ const ConfigScreen = () => {
150
152
try {
151
153
console . log ( `Checking Klaviyo connection status (attempt ${ attempt } /${ maxRetries } )...` ) ;
152
154
const appActions = await sdk . cma . appAction . getMany ( {
153
- organizationId : sdk . ids . organization ,
155
+ organizationId : orgId ,
154
156
appDefinitionId : sdk . ids . app ,
155
157
} ) ;
156
158
@@ -229,7 +231,7 @@ const ConfigScreen = () => {
229
231
const appDefinitionId = sdk . ids . app ;
230
232
// call app action to complete oauth
231
233
const appActions = await sdk . cma . appAction . getMany ( {
232
- organizationId : sdk . ids . organization ,
234
+ organizationId : orgId ,
233
235
appDefinitionId,
234
236
} ) ;
235
237
console . log ( 'appActions' , appActions ) ;
@@ -282,7 +284,7 @@ const ConfigScreen = () => {
282
284
283
285
try {
284
286
const appActions = await sdk . cma . appAction . getMany ( {
285
- organizationId : sdk . ids . organization ,
287
+ organizationId : orgId ,
286
288
appDefinitionId : sdk . ids . app ,
287
289
} ) ;
288
290
@@ -323,7 +325,7 @@ const ConfigScreen = () => {
323
325
setIsDisconnecting ( true ) ;
324
326
try {
325
327
const appActions = await sdk . cma . appAction . getMany ( {
326
- organizationId : sdk . ids . organization ,
328
+ organizationId : orgId ,
327
329
appDefinitionId : sdk . ids . app ,
328
330
} ) ;
329
331
const disconnectAppAction = appActions . items . find ( ( action ) => action . name === 'Disconnect' ) ;
0 commit comments