アクションを公開してすべてのインサイトを取得
インサイトを表示するTypescriptの例を次に示します。recordContextは現在のブラウザ・タブのアクティブ・レコードとみなされます:
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'V1');
const tabContext: ITabContext = await frameworkProvider.getCurrentBrowserTabContext()
let recordContext: IRecordContext = await tabContext.getActiveRecord();
let insightContext: IInsightsContext = await recordContext.getInsightsContext();
const payload: IShowInsightsRequest = frameworkProvider.requestHelper.createPublishRequest('GetAllInsights') as IShowInsightsRequest;
insightContext.publish(payload).then((response: IOperationResponse) => {
const insightsGetAllOperationResponse = response as IInsightsGetAllOperationResponse;
console.log((insightsGetAllOperationResponse.getResponseData() as IInsightsGetAllOperationResponseData).getInsights());
});
recordContextを現在のブラウザ・タブのアクティブ・レコードとみなして、インサイトを表示するJavaScriptの例を次に示します:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'V1');
const tabContext = await frameworkProvider.getCurrentBrowserTabContext();
let recordContext = await tabContext.getActiveRecord();
let insightContext = await recordContext.getInsightsContext();
const payload = frameworkProvider.requestHelper.createPublishRequest('GetAllInsights');
insightContext.publish(payload).then((response) => {
const insightsGetAllOperationResponse = response;
console.log(insightsGetAllOperationResponse.getResponseData().getInsights());
});