Skip to content

Commit 31427fa

Browse files
fix: use correct orgId for app actions [INTEG-3018] (#10055)
* fix: use correct orgId for app actions * fix: declare orgId in constructor
1 parent 77a980a commit 31427fa

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

apps/mux/frontend/src/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
generateAutoCaptions,
5454
} from './util/muxApi';
5555
import Sidebar from './locations/Sidebar';
56+
import { APP_ORGANIZATION_ID, isMarketplaceVersion } from './util/constants';
5657

5758
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
5859

@@ -104,6 +105,7 @@ export class App extends React.Component<AppProps, AppState> {
104105
muxPlayerRef = React.createRef<any>(); // eslint-disable-line @typescript-eslint/no-explicit-any
105106
getSignedTokenActionId: string;
106107
private pollPending = false;
108+
orgId: string;
107109

108110
constructor(props: AppProps) {
109111
super(props);
@@ -151,6 +153,10 @@ export class App extends React.Component<AppProps, AppState> {
151153
storyboardToken: undefined,
152154
raw: undefined,
153155
};
156+
157+
this.orgId = isMarketplaceVersion({ appId: this.props.sdk.ids.app })
158+
? APP_ORGANIZATION_ID
159+
: this.props.sdk.ids.organization;
154160
}
155161

156162
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -207,7 +213,7 @@ export class App extends React.Component<AppProps, AppState> {
207213

208214
async componentDidMount() {
209215
const appActionsResponse = await this.cmaClient.appAction.getMany({
210-
organizationId: this.props.sdk.ids.organization,
216+
organizationId: this.orgId,
211217
appDefinitionId: this.props.sdk.ids.app!,
212218
});
213219
this.getSignedTokenActionId =
@@ -503,7 +509,7 @@ export class App extends React.Component<AppProps, AppState> {
503509
response: { body },
504510
} = await this.cmaClient.appActionCall.createWithResponse(
505511
{
506-
organizationId: this.props.sdk.ids.organization,
512+
organizationId: this.orgId,
507513
appDefinitionId: this.props.sdk.ids.app!,
508514
appActionId: this.getSignedTokenActionId,
509515
},
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const APP_ORGANIZATION_ID = '5EJGHo8tYJcjnEhYWDxivp';
2+
const APP_DEFINITION_ID = '5l4WmuXdhJGcADHfCm1v4k';
3+
4+
export const isMarketplaceVersion = ({ appId }: { appId: string | undefined }) => {
5+
return !!appId && appId === APP_DEFINITION_ID;
6+
};

0 commit comments

Comments
 (0)