diff --git a/README.md b/README.md index 5984c4fe..50bed960 100644 --- a/README.md +++ b/README.md @@ -152,5 +152,4 @@ To activate Mock Firebolt, there are specific start-up scripts that exist inside For pinChallenge and acknowledgeChallenge UI prompts , a timeout of 15s is added so that, if no action is taken when the prompts displays on the screen (i.e; neither yes/no/back button ), the prompts will be automatically dismissed with "null" value as the response. The prompt is displayed when the user needs to grant/deny a particular api, or the user has to enter a pin in-case of pinChallenge. -If user wants to grant an api, yes button is pressed, for deniel - no button, and incase if the user wants to dismiss the prompt without any action, back button is pressed. - +If user wants to grant an api, yes button is pressed, for deniel - no button, and incase if the user wants to dismiss the prompt without any action, back button is pressed. \ No newline at end of file diff --git a/src/FireboltExampleInvoker.js b/src/FireboltExampleInvoker.js index ffa1f666..4f7ce0e3 100644 --- a/src/FireboltExampleInvoker.js +++ b/src/FireboltExampleInvoker.js @@ -100,6 +100,13 @@ export const MODULE_MAP = { discovery: DISCOVERY_MODULE_MAP, }; +// importing additional invoker which has external sdk's being exported and adding those modules in the MODULE_MAP +try { + const additionalInvoker = require('../plugins/FireboltExtensionInvoker').default; + Object.assign(MODULE_MAP, additionalInvoker); +} catch (err) { + logger.error(`Unable to import additional invoker - ${err.message}`, 'MODULE_MAP'); +} let instance = null; export default class FireboltExampleInvoker { diff --git a/src/ValidationView.js b/src/ValidationView.js index a998aca0..f53317b3 100644 --- a/src/ValidationView.js +++ b/src/ValidationView.js @@ -180,7 +180,9 @@ export default class ValidationView extends lng.Component { // Combine defaultSDKs and additionalSDKs into one array const allSDKs = [...CONSTANTS.defaultSDKs, ...CONSTANTS.additionalSDKs]; // Find the SDK configuration for the specified sdk mode - const sdkConfig = allSDKs.find((sdk) => sdkMode.includes(sdk.name.toUpperCase())); + const sdkConfigs = allSDKs.filter((sdk) => sdkMode.toUpperCase().includes(sdk.name.toUpperCase())); + const exactMatch = sdkConfigs.find((sdk) => sdkMode.toUpperCase() === sdk.name.toUpperCase()); + const sdkConfig = exactMatch || (sdkConfigs.length === 1 && sdkConfigs[0]) || sdkConfigs; // If SDK config found and validation method exists if (sdkConfig && sdkConfig.validation) { if (!sdkConfig.validation()) { diff --git a/src/pubsub/handlers/setApiResponseHandler.js b/src/pubsub/handlers/setApiResponseHandler.js index 364e26de..4eb54a3b 100644 --- a/src/pubsub/handlers/setApiResponseHandler.js +++ b/src/pubsub/handlers/setApiResponseHandler.js @@ -45,6 +45,8 @@ export default class SetApiResponseHandler extends BaseHandler { return this.setResponseAckChallenge(message); case 'userinterest': return this.setResponseUserInterestChallenge(message); + case 'external': + return this.setExternalResponse(message); default: const defaultIdString = JSON.stringify({ report: 'Selected module provider is not available', @@ -102,4 +104,14 @@ export default class SetApiResponseHandler extends BaseHandler { const reportIdString = JSON.stringify({ report: 'Received UserInterest apiResponse parameters' }); return reportIdString; } + + // importing external Api resonse function, which can set the pre-requisite values to external modules + setExternalResponse(message) { + try { + const externalFunction = require('../../../plugins/setExternalApiResponse'); + return externalFunction.setExternalApiResponse(message); + } catch (err) { + return JSON.stringify({ report: 'Unable to import and set the data for external module' }); + } + } }