@webex/plugin-attachment-actions 3.10.0-wxc-disconnect.1 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -302,7 +302,7 @@ var AttachmentActions = _webexCore.WebexPlugin.extend({
302
302
  return null;
303
303
  }
304
304
  },
305
- version: "3.10.0-wxc-disconnect.1"
305
+ version: "0.0.0"
306
306
  });
307
307
  var _default = exports.default = AttachmentActions;
308
308
  //# sourceMappingURL=attachmentActions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_common","_lodash","debug","AttachmentActions","WebexPlugin","extend","initialize","_len","arguments","length","args","Array","_key","_apply","default","prototype","listen","_this","createEventEnvelope","webex","SDK_EVENT","EXTERNAL","RESOURCE","ATTACHMENT_ACTIONS","then","envelope","eventEnvelope","internal","mercury","connect","listenTo","INTERNAL","WEBEX_ACTIVITY","event","onWebexApiEvent","create","attachmentAction","request","method","service","resource","body","res","get","id","concat","items","activity","data","verb","ACTIVITY_VERB","CARD_ACTION","createdEvent","getattachmentActionEvent","EVENT_TYPE","CREATED","_stringify","trigger","sdkEvent","cloneDeep","cluster","getHydraClusterString","target","url","created","published","actorId","constructHydraId","hydraTypes","PEOPLE","actor","entryUUID","roomId","ROOM","messageId","MESSAGE","parent","personId","ATTACHMENT_ACTION","object","inputs","type","objectType","e","logger","error","message","version","_default","exports"],"sources":["attachmentActions.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\nimport {\n SDK_EVENT,\n createEventEnvelope,\n constructHydraId,\n getHydraClusterString,\n hydraTypes,\n} from '@webex/common';\nimport {cloneDeep} from 'lodash';\n\nconst debug = require('debug')('attachmentActions');\n\n/**\n * @typedef {Object} AttachmentActionObject\n * @property {string} id - (server generated) Unique identifier for the attachment action\n * @property {string} messageId - The ID of the message in which attachment action is to be performed\n * @property {string} type - The type of attachment action eg., submit\n * @property {Object} inputs - The inputs for form fields in attachment message\n * @property {string} personId - (server generated) The ID for the author of the attachment action\n * @property {string} roomId - (server generated) The ID for the room of the message\n * @property {isoDate} created - (server generated) The date and time that the message was created\n */\n\n/**\n * AttachmentActions are events that communicate information when a user clicks on an\n * Action.Submit button in a card displayed in Webex\n * Information conveyed in an AttachmentAction includes details about the user that\n * clicked the button along with any card specific inputs. See the\n * {@link https://developer.webex.com/docs/api/v1/attachment-actions|Attachments Actions API Documentation}\n * for more details\n * @class\n */\nconst AttachmentActions = WebexPlugin.extend({\n /**\n * Initializer used to generate AttachmentActions\n * as a plugin wrapped around the provided arguments.\n * @private\n * @see WebexPlugin.initialize\n * @param {...any} args\n * @returns {undefined}\n */\n initialize(...args) {\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n },\n\n /**\n * Register to listen for incoming attachmentAction events\n * This is an alternate approach to registering for attachmentAction webhooks.\n * The events passed to any registered handlers will be similar to the webhook JSON,\n * but will omit webhook specific fields such as name, secret, url, etc.\n * The attachmentActions.listen() event objects can also include additional fields not\n * available in the webhook's JSON payload, specifically: `inputs`.\n * To utilize the `listen()` method, the authorization token used\n * will need to have `spark:all` and `spark:kms` scopes enabled.\n * Note that by configuring your application to enable or disable `spark:all`\n * via its configuration page will also enable or disable `spark:kms`.\n * See the <a href=\"https://webex.github.io/webex-js-sdk/samples/browser-socket/\">Sample App</a>\n * for more details.\n * @instance\n * @memberof Messages\n * @returns {Promise}\n * @example\n * webex.attachmentActions.listen()\n * .then(() => {\n * console.log('listening to attachmentActions events');\n * webex.attachmentActions.on('created', (event) => console.log(`Got an attachmentActions:created event:\\n${event}`));\n * })\n * .catch((e) => console.error(`Unable to register for attachmentAction events: ${e}`));\n * // Some app logic...\n * // WHen it is time to cleanup\n * webex.attachmentActions.stopListening();\n * webex.attachmentActions.off('created');\n */\n listen() {\n // Create a common envelope that we will wrap all events in\n return createEventEnvelope(this.webex, SDK_EVENT.EXTERNAL.RESOURCE.ATTACHMENT_ACTIONS).then(\n (envelope) => {\n this.eventEnvelope = envelope;\n\n // Register to listen to events\n return this.webex.internal.mercury.connect().then(() => {\n this.listenTo(this.webex.internal.mercury, SDK_EVENT.INTERNAL.WEBEX_ACTIVITY, (event) =>\n this.onWebexApiEvent(event)\n );\n });\n }\n );\n },\n\n /**\n * Post a new attachment action for a message with attachment.\n * @instance\n * @memberof AttachmentActions\n * @param {AttachmentActionObject} attachmentAction\n * @returns {Promise<AttachmentActionObject>}\n * @example\n * webex.rooms.create({title: 'Create Message with card Example'})\n * .then(function(room) {\n * return webex.messages.create({\n * text: 'Howdy!',\n * roomId: room.id,\n * attachments:[ {\n * contentType: 'application/vnd.microsoft.card.adaptive',\n * content: {\n * type: 'AdaptiveCard',\n * version: '1.0',\n * body: [\n * {\n * type: 'TextBlock',\n * text: '',\n * size: 'large'\n * },\n * {\n * type: 'TextBlock',\n * text: 'Adaptive Cards',\n * separation: 'none'\n * }\n * {\n * type: 'Input.Date',\n * id: 'dueDate'\n * }\n * ],\n * actions: [\n * {\n * type: 'Action.Submit',\n * title: 'Due Date'\n * }\n * ]\n * }\n * }]\n * });\n * })\n * .then(function(message) {\n * return webex.attachmentActions.create({\n * type: 'submit',\n * messageId: message.id,\n * inputs:{\n * dueDate: '26/06/1995'\n * }\n * })\n * .then(function(attachmentAction)){\n * var assert = require('assert');\n * assert(attachmentAction.id);\n * assert(attachmentAction.type);\n * assert(attachmentAction.personId);\n * assert(attachmentAction.inputs);\n * assert(attachmentAction.messageId);\n * assert(attachmentAction.roomId);\n * assert(attachmentAction.created);\n * return 'success';\n * }\n * });\n * // => success\n */\n create(attachmentAction) {\n return this.request({\n method: 'POST',\n service: 'hydra',\n resource: 'attachment/actions',\n body: attachmentAction,\n }).then((res) => res.body);\n },\n\n /**\n * Returns a single attachment action.\n * @instance\n * @memberof AttachmentActions\n * @param {string} attachmentAction\n * @returns {Promise<AttachmentActionObject>}\n * @example\n * var attachmentAction;\n * webex.rooms.create({title: 'Get Message Example'})\n * .then(function(room) {\n * return webex.messages.create({\n * text: 'Howdy!',\n * roomId: room.id,\n * attachments:[ {\n * contentType: 'application/vnd.microsoft.card.adaptive',\n * content: {\n * type: 'AdaptiveCard',\n * version: '1.0',\n * body: [\n * {\n * type: 'TextBlock',\n * text: '',\n * size: 'large'\n * },\n * {\n * type: 'TextBlock',\n * text: 'Adaptive Cards',\n * separation: 'none'\n * },\n * {\n * type: 'Input.Date',\n * id: 'dueDate'\n * }\n * ],\n * actions: [\n * {\n * type: 'Action.Submit',\n * title: 'Due Date'\n * }\n * ]\n * }\n * }]\n * });\n * })\n * .then(function(message) {\n * return webex.attachmentActions.create({\n * type: 'submit',\n * messageId: message.id,\n * inputs:{\n * dueDate: '26/06/1995'\n * });\n * })\n * .then(function(attachmentAction) {\n * return webex.attachmentActions.get(attachmentAction.id)\n * })\n * .then(function(attachmentAction){\n * var assert = require('assert');\n * assert.deepEqual(attachmentAction, attachmentAction);\n * return 'success';\n * })\n * // => success\n */\n get(attachmentAction) {\n const id = attachmentAction.id || attachmentAction;\n\n return this.request({\n service: 'hydra',\n resource: `attachment/actions/${id}`,\n }).then((res) => res.body.items || res.body);\n },\n\n /**\n * This function is called when an internal mercury events fires,\n * if the user registered for these events with the listen() function.\n * External users of the SDK should not call this function\n * @private\n * @memberof AttachmentAction\n * @param {Object} event\n * @returns {void}\n */\n onWebexApiEvent(event) {\n const {activity} = event.data;\n\n /* eslint-disable no-case-declarations */\n switch (activity.verb) {\n case SDK_EVENT.INTERNAL.ACTIVITY_VERB.CARD_ACTION:\n const createdEvent = this.getattachmentActionEvent(\n activity,\n SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED\n );\n\n if (createdEvent) {\n debug(`attachmentAction \"created\" payload: \\\n ${JSON.stringify(createdEvent)}`);\n this.trigger(SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED, createdEvent);\n }\n break;\n\n default: {\n break;\n }\n }\n },\n\n /**\n * Constructs the data object for an event on the attachmentAction resource,\n * adhering to Hydra's Webhook data structure messages.\n * External users of the SDK should not call this function\n * @private\n * @memberof AttachmentAction\n * @param {Object} activity from mercury\n * @param {Object} event type of \"webhook\" event\n * @returns {Object} constructed event\n */\n getattachmentActionEvent(activity, event) {\n try {\n const sdkEvent = cloneDeep(this.eventEnvelope);\n const cluster = getHydraClusterString(this.webex, activity.target.url);\n\n sdkEvent.event = event;\n sdkEvent.data.created = activity.published;\n sdkEvent.actorId = constructHydraId(hydraTypes.PEOPLE, activity.actor.entryUUID, cluster);\n sdkEvent.data.roomId = constructHydraId(hydraTypes.ROOM, activity.target.id, cluster);\n sdkEvent.data.messageId = constructHydraId(hydraTypes.MESSAGE, activity.parent.id, cluster);\n sdkEvent.data.personId = constructHydraId(\n hydraTypes.PEOPLE,\n activity.actor.entryUUID,\n cluster\n );\n // Seems like it would be nice to have this, but its not in the hydra webhook\n // sdkEvent.data.personEmail =\n // activity.actor.emailAddress || activity.actor.entryEmail;\n\n sdkEvent.data.id = constructHydraId(hydraTypes.ATTACHMENT_ACTION, activity.id, cluster);\n if (activity.object.inputs) {\n sdkEvent.data.inputs = activity.object.inputs;\n }\n sdkEvent.data.type = activity.object.objectType;\n\n return sdkEvent;\n } catch (e) {\n this.webex.logger.error(`Unable to generate SDK event from mercury \\\n'socket activity for attachmentAction:${event} event: ${e.message}`);\n\n return null;\n }\n },\n});\n\nexport default AttachmentActions;\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA,IAAAE,OAAA,GAAAF,OAAA;AAZA;AACA;AACA;;AAYA,IAAMG,KAAK,GAAGH,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMI,iBAAiB,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAC3C;AACF;AACA;AACA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,MAAM,WAAAA,OAACC,gBAAgB,EAAE;IACvB,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,oBAAoB;MAC9BC,IAAI,EAAEL;IACR,CAAC,CAAC,CAACZ,IAAI,CAAC,UAACkB,GAAG;MAAA,OAAKA,GAAG,CAACD,IAAI;IAAA,EAAC;EAC5B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,GAAG,WAAAA,IAACP,gBAAgB,EAAE;IACpB,IAAMQ,EAAE,GAAGR,gBAAgB,CAACQ,EAAE,IAAIR,gBAAgB;IAElD,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBE,OAAO,EAAE,OAAO;MAChBC,QAAQ,wBAAAK,MAAA,CAAwBD,EAAE;IACpC,CAAC,CAAC,CAACpB,IAAI,CAAC,UAACkB,GAAG;MAAA,OAAKA,GAAG,CAACD,IAAI,CAACK,KAAK,IAAIJ,GAAG,CAACD,IAAI;IAAA,EAAC;EAC9C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEP,eAAe,WAAAA,gBAACD,KAAK,EAAE;IACrB,IAAOc,QAAQ,GAAId,KA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AAI,CAAC0B,SAAS,GAAG,IAAAP,wBAAgB,EAACC,kBAAU,CAACO,OAAO,EAAE5B,QAAQ,CAAC6B,MAAM,CAAChC,EAAE,EAAEgB,OAAO,CAAC;MAC3FF,QAAQ,CAACV,IAAI,CAAC6B,QAAQ,GAAG,IAAAV,wBAAgB,EACvCC,kBAAU,CAACC,MAAM,EACjBtB,QAAQ,CAACuB,KAAK,CAACC,SAAS,EACxBX,OACF,CAAC;MACD;MACA;MACA;;MAEAF,QAAQ,CAACV,IAAI,CAACJ,EAAE,GAAG,IAAAuB,wBAAgB,EAACC,kBAAU,CAACU,iBAAiB,EAAE/B,QAAQ,CAACH,EAAE,EAAEgB,OAAO,CAAC;MACvF,IAAIb,QAAQ,CAACgC,MAAM,CAACC,MAAM,EAAE;QAC1BtB,QAAQ,CAACV,IAAI,CAACgC,MAAM,GAAGjC,QAAQ,CAACgC,MAAM,CAACC,MAAM;MAC/C;MACAtB,QAAQ,CAACV,IAAI,CAACiC,IAAI,GAAGlC,QAAQ,CAACgC,MAAM,CAACG,UAAU;MAE/C,OAAOxB,QAAQ;IACjB,CAAC,CAAC,OAAOyB,CAAC,EAAE;MACV,IAAI,CAAChE,KAAK,CAACiE,MAAM,CAACC,KAAK,oFAAAxC,MAAA,CACWZ,KAAK,cAAAY,MAAA,CAAWsC,CAAC,CAACG,OAAO,CAAE,CAAC;MAE9D,OAAO,IAAI;IACb;EACF,CAAC;EAAAC,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEYX,iBAAiB"}
1
+ {"version":3,"names":["_webexCore","require","_common","_lodash","debug","AttachmentActions","WebexPlugin","extend","initialize","_len","arguments","length","args","Array","_key","_apply","default","prototype","listen","_this","createEventEnvelope","webex","SDK_EVENT","EXTERNAL","RESOURCE","ATTACHMENT_ACTIONS","then","envelope","eventEnvelope","internal","mercury","connect","listenTo","INTERNAL","WEBEX_ACTIVITY","event","onWebexApiEvent","create","attachmentAction","request","method","service","resource","body","res","get","id","concat","items","activity","data","verb","ACTIVITY_VERB","CARD_ACTION","createdEvent","getattachmentActionEvent","EVENT_TYPE","CREATED","_stringify","trigger","sdkEvent","cloneDeep","cluster","getHydraClusterString","target","url","created","published","actorId","constructHydraId","hydraTypes","PEOPLE","actor","entryUUID","roomId","ROOM","messageId","MESSAGE","parent","personId","ATTACHMENT_ACTION","object","inputs","type","objectType","e","logger","error","message","version","_default","exports"],"sources":["attachmentActions.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\nimport {\n SDK_EVENT,\n createEventEnvelope,\n constructHydraId,\n getHydraClusterString,\n hydraTypes,\n} from '@webex/common';\nimport {cloneDeep} from 'lodash';\n\nconst debug = require('debug')('attachmentActions');\n\n/**\n * @typedef {Object} AttachmentActionObject\n * @property {string} id - (server generated) Unique identifier for the attachment action\n * @property {string} messageId - The ID of the message in which attachment action is to be performed\n * @property {string} type - The type of attachment action eg., submit\n * @property {Object} inputs - The inputs for form fields in attachment message\n * @property {string} personId - (server generated) The ID for the author of the attachment action\n * @property {string} roomId - (server generated) The ID for the room of the message\n * @property {isoDate} created - (server generated) The date and time that the message was created\n */\n\n/**\n * AttachmentActions are events that communicate information when a user clicks on an\n * Action.Submit button in a card displayed in Webex\n * Information conveyed in an AttachmentAction includes details about the user that\n * clicked the button along with any card specific inputs. See the\n * {@link https://developer.webex.com/docs/api/v1/attachment-actions|Attachments Actions API Documentation}\n * for more details\n * @class\n */\nconst AttachmentActions = WebexPlugin.extend({\n /**\n * Initializer used to generate AttachmentActions\n * as a plugin wrapped around the provided arguments.\n * @private\n * @see WebexPlugin.initialize\n * @param {...any} args\n * @returns {undefined}\n */\n initialize(...args) {\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n },\n\n /**\n * Register to listen for incoming attachmentAction events\n * This is an alternate approach to registering for attachmentAction webhooks.\n * The events passed to any registered handlers will be similar to the webhook JSON,\n * but will omit webhook specific fields such as name, secret, url, etc.\n * The attachmentActions.listen() event objects can also include additional fields not\n * available in the webhook's JSON payload, specifically: `inputs`.\n * To utilize the `listen()` method, the authorization token used\n * will need to have `spark:all` and `spark:kms` scopes enabled.\n * Note that by configuring your application to enable or disable `spark:all`\n * via its configuration page will also enable or disable `spark:kms`.\n * See the <a href=\"https://webex.github.io/webex-js-sdk/samples/browser-socket/\">Sample App</a>\n * for more details.\n * @instance\n * @memberof Messages\n * @returns {Promise}\n * @example\n * webex.attachmentActions.listen()\n * .then(() => {\n * console.log('listening to attachmentActions events');\n * webex.attachmentActions.on('created', (event) => console.log(`Got an attachmentActions:created event:\\n${event}`));\n * })\n * .catch((e) => console.error(`Unable to register for attachmentAction events: ${e}`));\n * // Some app logic...\n * // WHen it is time to cleanup\n * webex.attachmentActions.stopListening();\n * webex.attachmentActions.off('created');\n */\n listen() {\n // Create a common envelope that we will wrap all events in\n return createEventEnvelope(this.webex, SDK_EVENT.EXTERNAL.RESOURCE.ATTACHMENT_ACTIONS).then(\n (envelope) => {\n this.eventEnvelope = envelope;\n\n // Register to listen to events\n return this.webex.internal.mercury.connect().then(() => {\n this.listenTo(this.webex.internal.mercury, SDK_EVENT.INTERNAL.WEBEX_ACTIVITY, (event) =>\n this.onWebexApiEvent(event)\n );\n });\n }\n );\n },\n\n /**\n * Post a new attachment action for a message with attachment.\n * @instance\n * @memberof AttachmentActions\n * @param {AttachmentActionObject} attachmentAction\n * @returns {Promise<AttachmentActionObject>}\n * @example\n * webex.rooms.create({title: 'Create Message with card Example'})\n * .then(function(room) {\n * return webex.messages.create({\n * text: 'Howdy!',\n * roomId: room.id,\n * attachments:[ {\n * contentType: 'application/vnd.microsoft.card.adaptive',\n * content: {\n * type: 'AdaptiveCard',\n * version: '1.0',\n * body: [\n * {\n * type: 'TextBlock',\n * text: '',\n * size: 'large'\n * },\n * {\n * type: 'TextBlock',\n * text: 'Adaptive Cards',\n * separation: 'none'\n * }\n * {\n * type: 'Input.Date',\n * id: 'dueDate'\n * }\n * ],\n * actions: [\n * {\n * type: 'Action.Submit',\n * title: 'Due Date'\n * }\n * ]\n * }\n * }]\n * });\n * })\n * .then(function(message) {\n * return webex.attachmentActions.create({\n * type: 'submit',\n * messageId: message.id,\n * inputs:{\n * dueDate: '26/06/1995'\n * }\n * })\n * .then(function(attachmentAction)){\n * var assert = require('assert');\n * assert(attachmentAction.id);\n * assert(attachmentAction.type);\n * assert(attachmentAction.personId);\n * assert(attachmentAction.inputs);\n * assert(attachmentAction.messageId);\n * assert(attachmentAction.roomId);\n * assert(attachmentAction.created);\n * return 'success';\n * }\n * });\n * // => success\n */\n create(attachmentAction) {\n return this.request({\n method: 'POST',\n service: 'hydra',\n resource: 'attachment/actions',\n body: attachmentAction,\n }).then((res) => res.body);\n },\n\n /**\n * Returns a single attachment action.\n * @instance\n * @memberof AttachmentActions\n * @param {string} attachmentAction\n * @returns {Promise<AttachmentActionObject>}\n * @example\n * var attachmentAction;\n * webex.rooms.create({title: 'Get Message Example'})\n * .then(function(room) {\n * return webex.messages.create({\n * text: 'Howdy!',\n * roomId: room.id,\n * attachments:[ {\n * contentType: 'application/vnd.microsoft.card.adaptive',\n * content: {\n * type: 'AdaptiveCard',\n * version: '1.0',\n * body: [\n * {\n * type: 'TextBlock',\n * text: '',\n * size: 'large'\n * },\n * {\n * type: 'TextBlock',\n * text: 'Adaptive Cards',\n * separation: 'none'\n * },\n * {\n * type: 'Input.Date',\n * id: 'dueDate'\n * }\n * ],\n * actions: [\n * {\n * type: 'Action.Submit',\n * title: 'Due Date'\n * }\n * ]\n * }\n * }]\n * });\n * })\n * .then(function(message) {\n * return webex.attachmentActions.create({\n * type: 'submit',\n * messageId: message.id,\n * inputs:{\n * dueDate: '26/06/1995'\n * });\n * })\n * .then(function(attachmentAction) {\n * return webex.attachmentActions.get(attachmentAction.id)\n * })\n * .then(function(attachmentAction){\n * var assert = require('assert');\n * assert.deepEqual(attachmentAction, attachmentAction);\n * return 'success';\n * })\n * // => success\n */\n get(attachmentAction) {\n const id = attachmentAction.id || attachmentAction;\n\n return this.request({\n service: 'hydra',\n resource: `attachment/actions/${id}`,\n }).then((res) => res.body.items || res.body);\n },\n\n /**\n * This function is called when an internal mercury events fires,\n * if the user registered for these events with the listen() function.\n * External users of the SDK should not call this function\n * @private\n * @memberof AttachmentAction\n * @param {Object} event\n * @returns {void}\n */\n onWebexApiEvent(event) {\n const {activity} = event.data;\n\n /* eslint-disable no-case-declarations */\n switch (activity.verb) {\n case SDK_EVENT.INTERNAL.ACTIVITY_VERB.CARD_ACTION:\n const createdEvent = this.getattachmentActionEvent(\n activity,\n SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED\n );\n\n if (createdEvent) {\n debug(`attachmentAction \"created\" payload: \\\n ${JSON.stringify(createdEvent)}`);\n this.trigger(SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED, createdEvent);\n }\n break;\n\n default: {\n break;\n }\n }\n },\n\n /**\n * Constructs the data object for an event on the attachmentAction resource,\n * adhering to Hydra's Webhook data structure messages.\n * External users of the SDK should not call this function\n * @private\n * @memberof AttachmentAction\n * @param {Object} activity from mercury\n * @param {Object} event type of \"webhook\" event\n * @returns {Object} constructed event\n */\n getattachmentActionEvent(activity, event) {\n try {\n const sdkEvent = cloneDeep(this.eventEnvelope);\n const cluster = getHydraClusterString(this.webex, activity.target.url);\n\n sdkEvent.event = event;\n sdkEvent.data.created = activity.published;\n sdkEvent.actorId = constructHydraId(hydraTypes.PEOPLE, activity.actor.entryUUID, cluster);\n sdkEvent.data.roomId = constructHydraId(hydraTypes.ROOM, activity.target.id, cluster);\n sdkEvent.data.messageId = constructHydraId(hydraTypes.MESSAGE, activity.parent.id, cluster);\n sdkEvent.data.personId = constructHydraId(\n hydraTypes.PEOPLE,\n activity.actor.entryUUID,\n cluster\n );\n // Seems like it would be nice to have this, but its not in the hydra webhook\n // sdkEvent.data.personEmail =\n // activity.actor.emailAddress || activity.actor.entryEmail;\n\n sdkEvent.data.id = constructHydraId(hydraTypes.ATTACHMENT_ACTION, activity.id, cluster);\n if (activity.object.inputs) {\n sdkEvent.data.inputs = activity.object.inputs;\n }\n sdkEvent.data.type = activity.object.objectType;\n\n return sdkEvent;\n } catch (e) {\n this.webex.logger.error(`Unable to generate SDK event from mercury \\\n'socket activity for attachmentAction:${event} event: ${e.message}`);\n\n return null;\n }\n },\n});\n\nexport default AttachmentActions;\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA,IAAAE,OAAA,GAAAF,OAAA;AAZA;AACA;AACA;;AAYA,IAAMG,KAAK,GAAGH,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMI,iBAAiB,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAC3C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,UAAU,WAAVA,UAAUA,CAAA,EAAU;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAANC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAChB,IAAAC,MAAA,CAAAC,OAAA,EAAcV,sBAAW,CAACW,SAAS,CAACT,UAAU,EAAE,IAAI,EAAEI,IAAI,CAAC;EAC7D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,MAAM,WAANA,MAAMA,CAAA,EAAG;IAAA,IAAAC,KAAA;IACP;IACA,OAAO,IAAAC,2BAAmB,EAAC,IAAI,CAACC,KAAK,EAAEC,iBAAS,CAACC,QAAQ,CAACC,QAAQ,CAACC,kBAAkB,CAAC,CAACC,IAAI,CACzF,UAACC,QAAQ,EAAK;MACZR,KAAI,CAACS,aAAa,GAAGD,QAAQ;;MAE7B;MACA,OAAOR,KAAI,CAACE,KAAK,CAACQ,QAAQ,CAACC,OAAO,CAACC,OAAO,CAAC,CAAC,CAACL,IAAI,CAAC,YAAM;QACtDP,KAAI,CAACa,QAAQ,CAACb,KAAI,CAACE,KAAK,CAACQ,QAAQ,CAACC,OAAO,EAAER,iBAAS,CAACW,QAAQ,CAACC,cAAc,EAAE,UAACC,KAAK;UAAA,OAClFhB,KAAI,CAACiB,eAAe,CAACD,KAAK,CAAC;QAAA,CAC7B,CAAC;MACH,CAAC,CAAC;IACJ,CACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,MAAM,WAANA,MAAMA,CAACC,gBAAgB,EAAE;IACvB,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,oBAAoB;MAC9BC,IAAI,EAAEL;IACR,CAAC,CAAC,CAACZ,IAAI,CAAC,UAACkB,GAAG;MAAA,OAAKA,GAAG,CAACD,IAAI;IAAA,EAAC;EAC5B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,MAAM,CAACC,MAAM;MAC/C;MACAtB,QAAQ,CAACV,IAAI,CAACiC,IAAI,GAAGlC,QAAQ,CAACgC,MAAM,CAACG,UAAU;MAE/C,OAAOxB,QAAQ;IACjB,CAAC,CAAC,OAAOyB,CAAC,EAAE;MACV,IAAI,CAAChE,KAAK,CAACiE,MAAM,CAACC,KAAK,oFAAAxC,MAAA,CACWZ,KAAK,cAAAY,MAAA,CAAWsC,CAAC,CAACG,OAAO,CAAE,CAAC;MAE9D,OAAO,IAAI;IACb;EACF,CAAC;EAAAC,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEYX,iBAAiB","ignoreList":[]}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["require","_webexCore","_attachmentActions","_interopRequireDefault","registerPlugin","AttachmentActions","_default","exports","default"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-conversation'; // decrypt mercury activities\nimport '@webex/internal-plugin-mercury';\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport AttachmentActions from './attachmentActions';\n\nregisterPlugin('attachmentActions', AttachmentActions);\n\nexport default AttachmentActions;\n"],"mappings":";;;;;;;;AAIAA,OAAA;AACAA,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAE8C;;AAO9C,IAAAI,yBAAc,EAAC,mBAAmB,EAAEC,0BAAiB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExCH,0BAAiB"}
1
+ {"version":3,"names":["require","_webexCore","_attachmentActions","_interopRequireDefault","registerPlugin","AttachmentActions","_default","exports","default"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-conversation'; // decrypt mercury activities\nimport '@webex/internal-plugin-mercury';\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport AttachmentActions from './attachmentActions';\n\nregisterPlugin('attachmentActions', AttachmentActions);\n\nexport default AttachmentActions;\n"],"mappings":";;;;;;;;AAIAA,OAAA;AACAA,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAE8C;;AAO9C,IAAAI,yBAAc,EAAC,mBAAmB,EAAEC,0BAAiB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExCH,0BAAiB","ignoreList":[]}
package/package.json CHANGED
@@ -22,17 +22,17 @@
22
22
  ]
23
23
  },
24
24
  "dependencies": {
25
- "@webex/common": "3.10.0-wxc-disconnect.1",
26
- "@webex/internal-plugin-conversation": "3.10.0-wxc-disconnect.1",
27
- "@webex/internal-plugin-mercury": "3.10.0-wxc-disconnect.1",
28
- "@webex/webex-core": "3.10.0-wxc-disconnect.1",
25
+ "@webex/common": "3.11.0",
26
+ "@webex/internal-plugin-conversation": "3.11.0",
27
+ "@webex/internal-plugin-mercury": "3.11.0",
28
+ "@webex/webex-core": "3.11.0",
29
29
  "debug": "^4.3.4",
30
30
  "lodash": "^4.17.21"
31
31
  },
32
32
  "peerDependencies": {
33
- "@webex/plugin-logger": "3.10.0-wxc-disconnect.1",
34
- "@webex/plugin-messages": "3.10.0-wxc-disconnect.1",
35
- "@webex/plugin-people": "3.10.0-wxc-disconnect.1"
33
+ "@webex/plugin-logger": "3.11.0",
34
+ "@webex/plugin-messages": "3.11.0",
35
+ "@webex/plugin-people": "3.11.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "yarn build:src",
@@ -48,15 +48,15 @@
48
48
  "@webex/eslint-config-legacy": "0.0.0",
49
49
  "@webex/jest-config-legacy": "0.0.0",
50
50
  "@webex/legacy-tools": "0.0.0",
51
- "@webex/plugin-logger": "3.10.0-wxc-disconnect.1",
52
- "@webex/plugin-messages": "3.10.0-wxc-disconnect.1",
53
- "@webex/plugin-people": "3.10.0-wxc-disconnect.1",
54
- "@webex/test-helper-chai": "3.10.0-wxc-disconnect.1",
55
- "@webex/test-helper-mocha": "3.10.0-wxc-disconnect.1",
56
- "@webex/test-helper-mock-webex": "3.10.0-wxc-disconnect.1",
57
- "@webex/test-helper-test-users": "3.10.0-wxc-disconnect.1",
51
+ "@webex/plugin-logger": "3.11.0",
52
+ "@webex/plugin-messages": "3.11.0",
53
+ "@webex/plugin-people": "3.11.0",
54
+ "@webex/test-helper-chai": "3.11.0",
55
+ "@webex/test-helper-mocha": "3.11.0",
56
+ "@webex/test-helper-mock-webex": "3.11.0",
57
+ "@webex/test-helper-test-users": "3.11.0",
58
58
  "eslint": "^8.24.0",
59
59
  "prettier": "^2.7.1"
60
60
  },
61
- "version": "3.10.0-wxc-disconnect.1"
61
+ "version": "3.11.0"
62
62
  }