# marketplace-sdk

## Config Description

| Params | Description |
| --- | --- |
| marketplace | `Object` type. This has the mutliple options as below in the example.  |
| featureFlags | `Object` type. To idenfy wether the assets of the feature specified needs to be loaded or not. For example `{isMarketplaceNeeded: true}`|
| postProductSDKAssetsFetch | `Function` type. This is function will get called when the SDK assets are fetched and loaded. |
| locale | `String` type. To notify the extensions or platform related integration about the user's current locale. For example `en-US`. |
| eventListeners | `Object` To which all the SDK calls will be routed. For Example `{ DESK_EVENT: deskEventHandler }` |
| globalNameSpace | `String` type. The spcified string is converted to object with SDK methods. For example: If `ZOHODESK` is provided the generated SDK will be accessible as `ZOHODESK.get`. |
| events | `Object` type. To specify the events to be exposed to integrations/extensions. |
| renderWidgetActionConstant | `String` type. To identify the action which triggers the Widget Rendering. |
| isPromiseBasedAction | `Boolean` type. This denotes the actions that gets dispatched in the Application is in the instance of Promise.|

### Configuration Example
``` javascript
platformMiddleware({
    marketplace: {
      renderHandler: getDeskPluginManager, // Function
      postAssestsFetch: postAssetsFetch, // Function
      isDevMode: isDevMode, //Function
      requestHandler: RequestHandler, // Funtion
      notifyHandler:notifyHandler //Function
    },
    featureFlags: {
      isMarketplaceNeeded: true
    },
    postProductSDKAssetsFetch:()=>{ ZOHODESK.sdkPromise.res() },
    locale: 'en',
    eventListeners: { DESK_EVENT: deskEventHandler },
    globalNameSpace: 'ZOHODESK',
    events: PlatformEvents,
    renderWidgetActionConstant: 'RENDER_WIDGETS'
  })
  ```

### @zohodesk/platform-middleware - 0.0.1-beta.1

* Events Object mutation issue fixed

### @zohodesk/platform-middleware - 0.0.1-beta.2

* Invoke API request Object information issue fixed

### @zohodesk/platform-middleware - 0.0.1-beta.3

* Added Marketplace Feature Flag to download the assest.
* SDK changes to prevent the exisiting methods on the given namespace instead of overriding.

### @zohodesk/platform-middleware - 0.0.1-beta.4

* Global namespace overriding issue fix.

### @zohodesk/platform-middleware - 0.0.1-beta.5

* Dev mode changes merge issues fix.

### @zohodesk/platform-middleware - 0.0.1-beta.6
* Properties overriding fix for the getters/setters/invoke.

### @zohodesk/platform-middleware - 0.0.1-beta.7

* CRM PLUS case - events should broadcast after the state update.
* Addded the function support to the events and hooks for data construction.
* Issue fix for the Hook events which called twice.

### @zohodesk/platform-middleware - 0.0.1-beta.8

* URL CHANGE ACTION - this action gets dispatched twice to update in history and state, so we filtered to broadcast the event once.

### @zohodesk/platform-middleware - 0.0.1-beta.9

* Platform Instance undefined error - Fixed.

### @zohodesk/platform-middleware - 0.0.1-beta.10

* diaptch function added to SDK global namespace.

### @zohodesk/platform-middleware - 0.0.1-beta.11

* Hook event notify handler added as config from the Application.
* getState() method is passed instead the state object to event/hooks responseHandler function.

### @zohodesk/platform-middleware - 0.0.1-beta.12

* Hook event response Handler function rejewct handled.
* Hook reject error message issue fix.
* Selectn used for data fetch from nested object.

### @zohodesk/platform-middleware - 0.0.1-beta.13

* Event broadcasted before the next(action).

### @zohodesk/platform-middleware - 0.0.1-beta.14

* Added the callback support for the ProductSDK post assets fetch.
* The callback function should be specified in the config object while intializing the middleware as ```postProductSDKAssetsFetch```.

### @zohodesk/platform-middleware - 0.0.1-beta.15

* Added the config support to know the action type. For example the actions can be of promise based from the web worker implementation.
* The ```isPromiseBasedAction``` config needs to be passed as a boolean value while intializing the middleware.

### @zohodesk/platform-middleware - 0.0.1-beta.16

* Added the config decsription and sample to README file.
* Fixed validation issues.

### @zohodesk/platform-middleware - 0.0.1-beta.17

* Added the package-lock.json entry in the npmignore.

### @zohodesk/platform-middleware - 0.0.1-beta.18

* Provided the event name configuration as a function and array support for events names.
* Provided the ```getPrevState``` function to the responseHandler function.
* Provided the ```hookRejectCallback``` function in the action payload to listen the notification of the hookRejection.

### @zohodesk/platform-middleware - 0.0.1-beta.19
* Update a fix for hookRejectCallback - moved to one of key in the action.

### @zohodesk/platform-middleware - 0.0.1-beta.20
* Promise resolving not working properly - issue fixed
* Zoho one frame origin fixes for embeddable zoho services.

### @zohodesk/platform-middleware - 0.0.1-beta.21
* Removed unwanted next(action) called in hook rejection

### @zohodesk/platform-middleware - 0.0.1-beta.22
* Throw the error message to the reject callback while problem in responsehandler method

### @zohodesk/platform-middleware - 0.0.1-beta.23
* Hook rejection title and name handling fix

### @zohodesk/platform-middleware - 0.0.1-beta.24
* Hooks handling for without api action
* Support the customized event name

### @zohodesk/platform-middleware - 0.0.1-beta.25
* Reverting - Hooks handling for without api action from Previous version

### @zohodesk/platform-middleware - 0.0.1-beta.26
* Providing temprorly overrideInvokeMethodToCommonPattern flag hook for ProductSDK method.
* Flag check for marketplace config validation.

### @zohodesk/platform-middleware - 0.0.1-beta.27 & 0.0.1-beta.28
* Bundling issue fixed

### @zohodesk/platform-middleware - 0.0.1-beta.29
* Handling the multiple event listener functions.
* Provided the support to prevent the default notification popup for the hook rejection and custom title & message key.

### @zohodesk/platform-middleware - 0.0.1-beta.30 & 0.0.1-beta.31- Issue version
* The top bar for CRMPlus and ZohoOne is not functioning, even after the help widget is rendered. This issue needs to be addressed.

### @zohodesk/platform-middleware - 0.0.1-beta.32- Issue Version
* Support multiple widgets based on `eventListenerName` and `scopeName`.

### @zohodesk/platform-middleware - 0.0.1-beta.33
* Removed issue code from version 30-32
* Added new DC support(INEC and SG DC) in ZFramework.js