@webex/plugin-meetings 3.0.0-beta.180 → 3.0.0-beta.182

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.
@@ -80,6 +80,21 @@ export default class Parser {
80
80
  * @returns {string} loci comparison state
81
81
  */
82
82
  private static compareDelta;
83
+ /**
84
+ * Compares Locus sequences - it should be called only for full Locus DTOs, not deltas
85
+ *
86
+ * @param {Types~Locus} current Current working copy
87
+ * @param {Types~Locus} incomingFullDto New Full Locus DTO
88
+ * @returns {string} either Parser.loci.USE_INCOMING or Parser.loci.USE_CURRENT
89
+ */
90
+ static compareFullDtoSequence(current: any, incomingFullDto: any): string;
91
+ /**
92
+ * Returns true if the incoming full locus DTO is newer than the current working copy
93
+ *
94
+ * @param {Types~Locus} incomingFullDto New Full Locus DTO
95
+ * @returns {string} either Parser.loci.USE_INCOMING or Parser.loci.USE_CURRENT
96
+ */
97
+ isNewFullLocus(incomingFullDto: any): boolean;
83
98
  /**
84
99
  * Compares Locus sequences
85
100
  * @param {Types~Locus} current Current working copy
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-beta.180",
3
+ "version": "3.0.0-beta.182",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "contributors": [
@@ -32,12 +32,12 @@
32
32
  "build": "yarn run -T tsc --declaration true --declarationDir ./dist/types"
33
33
  },
34
34
  "devDependencies": {
35
- "@webex/plugin-meetings": "3.0.0-beta.180",
36
- "@webex/test-helper-chai": "3.0.0-beta.180",
37
- "@webex/test-helper-mocha": "3.0.0-beta.180",
38
- "@webex/test-helper-mock-webex": "3.0.0-beta.180",
39
- "@webex/test-helper-retry": "3.0.0-beta.180",
40
- "@webex/test-helper-test-users": "3.0.0-beta.180",
35
+ "@webex/plugin-meetings": "3.0.0-beta.182",
36
+ "@webex/test-helper-chai": "3.0.0-beta.182",
37
+ "@webex/test-helper-mocha": "3.0.0-beta.182",
38
+ "@webex/test-helper-mock-webex": "3.0.0-beta.182",
39
+ "@webex/test-helper-retry": "3.0.0-beta.182",
40
+ "@webex/test-helper-test-users": "3.0.0-beta.182",
41
41
  "chai": "^4.3.4",
42
42
  "chai-as-promised": "^7.1.1",
43
43
  "jsdom-global": "3.0.2",
@@ -46,19 +46,19 @@
46
46
  "typescript": "^4.7.4"
47
47
  },
48
48
  "dependencies": {
49
- "@webex/common": "3.0.0-beta.180",
49
+ "@webex/common": "3.0.0-beta.182",
50
50
  "@webex/internal-media-core": "1.39.1",
51
- "@webex/internal-plugin-conversation": "3.0.0-beta.180",
52
- "@webex/internal-plugin-device": "3.0.0-beta.180",
53
- "@webex/internal-plugin-llm": "3.0.0-beta.180",
54
- "@webex/internal-plugin-mercury": "3.0.0-beta.180",
55
- "@webex/internal-plugin-metrics": "3.0.0-beta.180",
56
- "@webex/internal-plugin-support": "3.0.0-beta.180",
57
- "@webex/internal-plugin-user": "3.0.0-beta.180",
58
- "@webex/media-helpers": "3.0.0-beta.180",
59
- "@webex/plugin-people": "3.0.0-beta.180",
60
- "@webex/plugin-rooms": "3.0.0-beta.180",
61
- "@webex/webex-core": "3.0.0-beta.180",
51
+ "@webex/internal-plugin-conversation": "3.0.0-beta.182",
52
+ "@webex/internal-plugin-device": "3.0.0-beta.182",
53
+ "@webex/internal-plugin-llm": "3.0.0-beta.182",
54
+ "@webex/internal-plugin-mercury": "3.0.0-beta.182",
55
+ "@webex/internal-plugin-metrics": "3.0.0-beta.182",
56
+ "@webex/internal-plugin-support": "3.0.0-beta.182",
57
+ "@webex/internal-plugin-user": "3.0.0-beta.182",
58
+ "@webex/media-helpers": "3.0.0-beta.182",
59
+ "@webex/plugin-people": "3.0.0-beta.182",
60
+ "@webex/plugin-rooms": "3.0.0-beta.182",
61
+ "@webex/webex-core": "3.0.0-beta.182",
62
62
  "ampersand-collection": "^2.0.2",
63
63
  "bowser": "^2.11.0",
64
64
  "btoa": "^1.2.1",
@@ -89,6 +89,20 @@ class Utils {
89
89
  return requiredHints.every((hint) => displayHints.includes(hint));
90
90
  }
91
91
 
92
+ /**
93
+ * Validate that the self policy object contains the required policies.
94
+ *
95
+ * @param {Object} config - Configuration Object.
96
+ * @param {Array<string>} config.requiredPolicies - Policies required for validation.
97
+ * @param {Array<string>} config.policies - All available policies.
98
+ * @returns {boolean} - True if all of the actions are allowed.
99
+ */
100
+ public static hasPolicies(config: {requiredPolicies: Array<string>; policies: Array<string>}) {
101
+ const {requiredPolicies, policies = {}} = config;
102
+
103
+ return requiredPolicies.every((hint) => policies[hint]);
104
+ }
105
+
92
106
  /**
93
107
  * Validate if an audio-scoped control is allowed to be sent to the service.
94
108
  *
@@ -267,13 +267,20 @@ export default class LocusInfo extends EventsScope {
267
267
  * @returns {object} null
268
268
  * @memberof LocusInfo
269
269
  */
270
- // eslint-disable-next-line @typescript-eslint/no-shadow
271
270
  onFullLocus(locus: any, eventType?: string) {
272
271
  if (!locus) {
273
272
  LoggerProxy.logger.error(
274
273
  'Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.'
275
274
  );
276
275
  }
276
+
277
+ if (!this.locusParser.isNewFullLocus(locus)) {
278
+ LoggerProxy.logger.info(
279
+ `Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=${eventType}`
280
+ );
281
+
282
+ return;
283
+ }
277
284
  this.updateParticipantDeltas(locus.participants);
278
285
  this.scheduledMeeting = locus.meeting || null;
279
286
  this.participants = locus.participants;
@@ -235,6 +235,49 @@ export default class Parser {
235
235
  return pack(comparison, result);
236
236
  }
237
237
 
238
+ /**
239
+ * Compares Locus sequences - it should be called only for full Locus DTOs, not deltas
240
+ *
241
+ * @param {Types~Locus} current Current working copy
242
+ * @param {Types~Locus} incomingFullDto New Full Locus DTO
243
+ * @returns {string} either Parser.loci.USE_INCOMING or Parser.loci.USE_CURRENT
244
+ */
245
+ static compareFullDtoSequence(current, incomingFullDto) {
246
+ if (Parser.isSequenceEmpty(current) || Parser.isSequenceEmpty(incomingFullDto)) {
247
+ return Parser.loci.USE_INCOMING;
248
+ }
249
+
250
+ // the sequence.entries list will always contain at least 1 entry
251
+ // https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Sequence-Comparison-Algorithm
252
+
253
+ return incomingFullDto.sequence.entries.slice(-1)[0] > current.sequence.entries.slice(-1)[0]
254
+ ? Parser.loci.USE_INCOMING
255
+ : Parser.loci.USE_CURRENT;
256
+ }
257
+
258
+ /**
259
+ * Returns true if the incoming full locus DTO is newer than the current working copy
260
+ *
261
+ * @param {Types~Locus} incomingFullDto New Full Locus DTO
262
+ * @returns {string} either Parser.loci.USE_INCOMING or Parser.loci.USE_CURRENT
263
+ */
264
+ isNewFullLocus(incomingFullDto) {
265
+ if (!Parser.isLoci(incomingFullDto)) {
266
+ LoggerProxy.logger.info('Locus-info:parser#isNewFullLocus --> Ignoring non-locus object.');
267
+
268
+ return false;
269
+ }
270
+
271
+ if (!this.workingCopy) {
272
+ // we don't have a working copy yet, so any full locus is better than nothing
273
+ return true;
274
+ }
275
+
276
+ const comparisonResult = Parser.compareFullDtoSequence(this.workingCopy, incomingFullDto);
277
+
278
+ return comparisonResult === Parser.loci.USE_INCOMING;
279
+ }
280
+
238
281
  /**
239
282
  * Compares Locus sequences
240
283
  * @param {Types~Locus} current Current working copy
@@ -90,6 +90,7 @@ import {
90
90
  HTTP_VERBS,
91
91
  SELF_ROLES,
92
92
  INTERPRETATION,
93
+ SELF_POLICY,
93
94
  } from '../constants';
94
95
  import BEHAVIORAL_METRICS from '../metrics/constants';
95
96
  import ParameterError from '../common/errors/parameter';
@@ -2585,22 +2586,42 @@ export default class Meeting extends StatelessWebexPlugin {
2585
2586
  requiredHints: [DISPLAY_HINTS.DISABLE_VIDEO],
2586
2587
  displayHints: payload.info.userDisplayHints,
2587
2588
  }),
2588
- canShareFile: ControlsOptionsUtil.hasHints({
2589
- requiredHints: [DISPLAY_HINTS.SHARE_FILE],
2590
- displayHints: payload.info.userDisplayHints,
2591
- }),
2592
- canShareApplication: ControlsOptionsUtil.hasHints({
2593
- requiredHints: [DISPLAY_HINTS.SHARE_APPLICATION],
2594
- displayHints: payload.info.userDisplayHints,
2595
- }),
2596
- canShareCamera: ControlsOptionsUtil.hasHints({
2597
- requiredHints: [DISPLAY_HINTS.SHARE_CAMERA],
2598
- displayHints: payload.info.userDisplayHints,
2599
- }),
2600
- canShareDesktop: ControlsOptionsUtil.hasHints({
2601
- requiredHints: [DISPLAY_HINTS.SHARE_DESKTOP],
2602
- displayHints: payload.info.userDisplayHints,
2603
- }),
2589
+ canShareFile:
2590
+ ControlsOptionsUtil.hasHints({
2591
+ requiredHints: [DISPLAY_HINTS.SHARE_FILE],
2592
+ displayHints: payload.info.userDisplayHints,
2593
+ }) &&
2594
+ ControlsOptionsUtil.hasPolicies({
2595
+ requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
2596
+ policies: this.selfUserPolicies,
2597
+ }),
2598
+ canShareApplication:
2599
+ ControlsOptionsUtil.hasHints({
2600
+ requiredHints: [DISPLAY_HINTS.SHARE_APPLICATION],
2601
+ displayHints: payload.info.userDisplayHints,
2602
+ }) &&
2603
+ ControlsOptionsUtil.hasPolicies({
2604
+ requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
2605
+ policies: this.selfUserPolicies,
2606
+ }),
2607
+ canShareCamera:
2608
+ ControlsOptionsUtil.hasHints({
2609
+ requiredHints: [DISPLAY_HINTS.SHARE_CAMERA],
2610
+ displayHints: payload.info.userDisplayHints,
2611
+ }) &&
2612
+ ControlsOptionsUtil.hasPolicies({
2613
+ requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
2614
+ policies: this.selfUserPolicies,
2615
+ }),
2616
+ canShareDesktop:
2617
+ ControlsOptionsUtil.hasHints({
2618
+ requiredHints: [DISPLAY_HINTS.SHARE_DESKTOP],
2619
+ displayHints: payload.info.userDisplayHints,
2620
+ }) &&
2621
+ ControlsOptionsUtil.hasPolicies({
2622
+ requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
2623
+ policies: this.selfUserPolicies,
2624
+ }),
2604
2625
  canShareContent: ControlsOptionsUtil.hasHints({
2605
2626
  requiredHints: [DISPLAY_HINTS.SHARE_CONTENT],
2606
2627
  displayHints: payload.info.userDisplayHints,