@zohodesk/platform-middleware

Generalized Contract for the events from Marketplace App, In-App widgets, CRM-Plus and EFC

Usage no npm install needed!

<script type="module">
  import zohodeskPlatformMiddleware from 'https://cdn.skypack.dev/@zohodesk/platform-middleware';
</script>

README

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

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