@@ -21,7 +21,6 @@ import {
2121 getEntryKlaviyoFieldMappings ,
2222 setEntryKlaviyoFieldMappings ,
2323} from '../utils/field-mappings' ;
24- import { getOrgIdForSdk } from '../utils/sdk-helpers' ;
2524
2625// Helper to ensure klaviyoFieldMappings entry exists
2726const ensureKlaviyoFieldMappingsEntry = async ( sdk : ConfigAppSDK ) => {
@@ -139,7 +138,6 @@ const ConfigScreen = () => {
139138 const [ isDisconnecting , setIsDisconnecting ] = useState ( false ) ;
140139 const popupWindowRef = useRef < Window | null > ( null ) ;
141140 const checkWindowIntervalRef = useRef < number | null > ( null ) ;
142- const orgId = getOrgIdForSdk ( sdk ) ;
143141
144142 // Check Klaviyo connection status with polling to handle race conditions
145143 const checkKlaviyoStatus = async (
@@ -151,9 +149,9 @@ const ConfigScreen = () => {
151149 for ( let attempt = 1 ; attempt <= maxRetries ; attempt ++ ) {
152150 try {
153151 console . log ( `Checking Klaviyo connection status (attempt ${ attempt } /${ maxRetries } )...` ) ;
154- const appActions = await sdk . cma . appAction . getMany ( {
155- organizationId : orgId ,
156- appDefinitionId : sdk . ids . app ,
152+ const appActions = await sdk . cma . appAction . getManyForEnvironment ( {
153+ environmentId : sdk . ids . environment ,
154+ spaceId : sdk . ids . space ,
157155 } ) ;
158156
159157 const checkStatusAppAction = appActions . items . find (
@@ -230,9 +228,9 @@ const ConfigScreen = () => {
230228 console . log ( 'oauth:complete' ) ;
231229 const appDefinitionId = sdk . ids . app ;
232230 // call app action to complete oauth
233- const appActions = await sdk . cma . appAction . getMany ( {
234- organizationId : orgId ,
235- appDefinitionId ,
231+ const appActions = await sdk . cma . appAction . getManyForEnvironment ( {
232+ environmentId : sdk . ids . environment ,
233+ spaceId : sdk . ids . space ,
236234 } ) ;
237235 console . log ( 'appActions' , appActions ) ;
238236 const completeOauthAppAction = appActions . items . find (
@@ -283,9 +281,9 @@ const ConfigScreen = () => {
283281 window . addEventListener ( 'message' , messageHandler ) ;
284282
285283 try {
286- const appActions = await sdk . cma . appAction . getMany ( {
287- organizationId : orgId ,
288- appDefinitionId : sdk . ids . app ,
284+ const appActions = await sdk . cma . appAction . getManyForEnvironment ( {
285+ environmentId : sdk . ids . environment ,
286+ spaceId : sdk . ids . space ,
289287 } ) ;
290288
291289 const initiateOauthAppAction = appActions . items . find (
@@ -324,9 +322,9 @@ const ConfigScreen = () => {
324322 const handleDisconnect = async ( ) => {
325323 setIsDisconnecting ( true ) ;
326324 try {
327- const appActions = await sdk . cma . appAction . getMany ( {
328- organizationId : orgId ,
329- appDefinitionId : sdk . ids . app ,
325+ const appActions = await sdk . cma . appAction . getManyForEnvironment ( {
326+ environmentId : sdk . ids . environment ,
327+ spaceId : sdk . ids . space ,
330328 } ) ;
331329 const disconnectAppAction = appActions . items . find ( ( action ) => action . name === 'Disconnect' ) ;
332330 await sdk . cma . appActionCall . create (
0 commit comments