AboutSupportDeveloper GuideVersion 22.3.18

Response from store registration which includes metadata and a function to update app cards buttons.

interface StoreRegistration {
    clientAPIVersion: string;
    updateAppCardButtons: ((request: UpdateButtonConfigRequest) => Promise<void>);
    workspaceVersion: string;
}

Hierarchy (view full)

Properties

clientAPIVersion: string

Client API version

This is the version of the Workspace client API that is being used to register the component.

updateAppCardButtons: ((request: UpdateButtonConfigRequest) => Promise<void>)

Function to updates app card button config.

Type declaration

    • (request): Promise<void>
    • Parameters

      • request: UpdateButtonConfigRequest

        object that contains primary button and secondary buttons configs that will be used to update button configuration returned by provider for an app.

      Returns Promise<void>

Updating primary button title and disabled flag.
 let storeRegistration: StoreRegistration | undefined;

await WorkspacePlatform.init({
customActions: {
storeButtonCustomActionHandler: async (payload: StoreCustomButtonActionPayload) => {
if (storeRegistration) {
await storeRegistration.updateAppCardButtons({
appId: payload.appId,
primaryButton: {
...payload.primaryButton,
title: 'Disabled Button',
disabled: true,
},
secondaryButtons: payload.secondaryButtons
});
}
}
}
});

const sampleApp: App = {
title: 'Sample Application',
addId: 'sampleAppId',
icons: [],
publisher: 'Sample',
primaryButton: {
title: 'Sample Button',
action: {
id: 'storeButtonCustomActionHandler',
}
}
},

const storefrontProvider: StorefrontProvider = {
title: 'Sample Store',
id: 'sampleStoreId',
icon: {...},
getApps: () => Promise.resolve([sampleApp]),
getLandingPage: {...},
getNavigation: {...},
getFooter: {...},
launchApp: (app: App) => WR.getCurrentSync().launchApp({app})
};

storeRegistration = await Store.register(storefrontProvider);
await Store.show();
workspaceVersion: string

Workspace version

This is the version of Workspace that the Workspace component is running on. This could be used to determine if the component is running on a version of Workspace that supports a particular feature.