@webex/plugin-meetings 3.0.0-beta.350 → 3.0.0-beta.352

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.
@@ -1026,6 +1026,9 @@ export default class Meetings extends WebexPlugin {
1026
1026
 
1027
1027
  /**
1028
1028
  * Create a meeting or return an existing meeting.
1029
+ *
1030
+ * When meeting info passed it should be complete, e.g.: fetched after password or captcha provided
1031
+ *
1029
1032
  * @param {string} destination - sipURL, phonenumber, or locus object}
1030
1033
  * @param {string} [type] - the optional specified type, such as locusId
1031
1034
  * @param {Boolean} useRandomDelayForInfo - whether a random delay should be added to fetching meeting info
@@ -1033,6 +1036,8 @@ export default class Meetings extends WebexPlugin {
1033
1036
  * @param {string} correlationId - the optional specified correlationId (callStateForMetrics.correlationId can be provided instead)
1034
1037
  * @param {Boolean} failOnMissingMeetingInfo - whether to throw an error if meeting info fails to fetch (for calls that are not 1:1 or content share)
1035
1038
  * @param {CallStateForMetrics} callStateForMetrics - information about call state for metrics
1039
+ * @param {Object} [meetingInfo] - Pre-fetched complete meeting info
1040
+ * @param {String} [meetingLookupUrl] - meeting info prefetch url
1036
1041
  * @returns {Promise<Meeting>} A new Meeting.
1037
1042
  * @public
1038
1043
  * @memberof Meetings
@@ -1044,7 +1049,9 @@ export default class Meetings extends WebexPlugin {
1044
1049
  infoExtraParams = {},
1045
1050
  correlationId: string = undefined,
1046
1051
  failOnMissingMeetingInfo = false,
1047
- callStateForMetrics: CallStateForMetrics = undefined
1052
+ callStateForMetrics: CallStateForMetrics = undefined,
1053
+ meetingInfo = undefined,
1054
+ meetingLookupUrl = undefined
1048
1055
  ) {
1049
1056
  // TODO: type should be from a dictionary
1050
1057
 
@@ -1103,7 +1110,9 @@ export default class Meetings extends WebexPlugin {
1103
1110
  useRandomDelayForInfo,
1104
1111
  infoExtraParams,
1105
1112
  callStateForMetrics,
1106
- failOnMissingMeetingInfo
1113
+ failOnMissingMeetingInfo,
1114
+ meetingInfo,
1115
+ meetingLookupUrl
1107
1116
  ).then((createdMeeting: any) => {
1108
1117
  // If the meeting was successfully created.
1109
1118
  if (createdMeeting && createdMeeting.on) {
@@ -1158,12 +1167,18 @@ export default class Meetings extends WebexPlugin {
1158
1167
  }
1159
1168
 
1160
1169
  /**
1170
+ * Create meeting
1171
+ *
1172
+ * When meeting info passed it should be complete, e.g.: fetched after password or captcha provided
1173
+ *
1161
1174
  * @param {String} destination see create()
1162
1175
  * @param {String} type see create()
1163
1176
  * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info
1164
1177
  * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
1165
1178
  * @param {CallStateForMetrics} callStateForMetrics - information about call state for metrics
1166
1179
  * @param {Boolean} failOnMissingMeetingInfo - whether to throw an error if meeting info fails to fetch (for calls that are not 1:1 or content share)
1180
+ * @param {Object} [meetingInfo] - Pre-fetched complete meeting info
1181
+ * @param {String} [meetingLookupUrl] - meeting info prefetch url
1167
1182
  * @returns {Promise} a new meeting instance complete with meeting info and destination
1168
1183
  * @private
1169
1184
  * @memberof Meetings
@@ -1174,7 +1189,9 @@ export default class Meetings extends WebexPlugin {
1174
1189
  useRandomDelayForInfo = false,
1175
1190
  infoExtraParams = {},
1176
1191
  callStateForMetrics: CallStateForMetrics = undefined,
1177
- failOnMissingMeetingInfo = false
1192
+ failOnMissingMeetingInfo = false,
1193
+ meetingInfo = undefined,
1194
+ meetingLookupUrl = undefined
1178
1195
  ) {
1179
1196
  const meeting = new Meeting(
1180
1197
  {
@@ -1220,22 +1237,26 @@ export default class Meetings extends WebexPlugin {
1220
1237
  const isMeetingActive = !!destination.fullState?.active;
1221
1238
  // @ts-ignore
1222
1239
  const {enableUnifiedMeetings} = this.config.experimental;
1223
-
1224
- if (enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0) {
1240
+ const meetingInfoOptions = {
1241
+ extraParams: infoExtraParams,
1242
+ sendCAevents: !!callStateForMetrics?.correlationId, // if client sends correlation id as argument of public create(), then it means that this meeting creation is part of a pre-join intent from user
1243
+ };
1244
+
1245
+ if (meetingInfo) {
1246
+ meeting.injectMeetingInfo(meetingInfo, meetingInfoOptions, meetingLookupUrl);
1247
+ } else if (
1248
+ enableUnifiedMeetings &&
1249
+ !isMeetingActive &&
1250
+ useRandomDelayForInfo &&
1251
+ waitingTime > 0
1252
+ ) {
1225
1253
  meeting.fetchMeetingInfoTimeoutId = setTimeout(
1226
- () =>
1227
- meeting.fetchMeetingInfo({
1228
- extraParams: infoExtraParams,
1229
- sendCAevents: !!callStateForMetrics?.correlationId, // if client sends correlation id as argument of public create(), then it means that this meeting creation is part of a pre-join intent from user
1230
- }),
1254
+ () => meeting.fetchMeetingInfo(meetingInfoOptions),
1231
1255
  waitingTime
1232
1256
  );
1233
1257
  meeting.parseMeetingInfo(undefined, destination);
1234
1258
  } else {
1235
- await meeting.fetchMeetingInfo({
1236
- extraParams: infoExtraParams,
1237
- sendCAevents: !!callStateForMetrics?.correlationId, // if client sends correlation id as argument of public create(), then it means that this meeting creation is part of a pre-join intent from user
1238
- });
1259
+ await meeting.fetchMeetingInfo(meetingInfoOptions);
1239
1260
  }
1240
1261
  } catch (err) {
1241
1262
  if (
@@ -2058,7 +2058,7 @@ describe('plugin-meetings', () => {
2058
2058
  });
2059
2059
 
2060
2060
  describe('#getTheLocusToUpdate', () => {
2061
- it('return the cache locus if return to main session', () => {
2061
+ it('return the cache locus if return to main session and do not clear main session cache', () => {
2062
2062
  locusInfo.mainSessionLocusCache = {url: 'url'};
2063
2063
  locusInfo.controls = {
2064
2064
  breakout: {
@@ -2074,9 +2074,13 @@ describe('plugin-meetings', () => {
2074
2074
  };
2075
2075
 
2076
2076
  assert.deepEqual(locusInfo.getTheLocusToUpdate(newLocus), {url: 'url'});
2077
+
2078
+ locusInfo.clearMainSessionLocusCache = sinon.stub();
2079
+ locusInfo.getTheLocusToUpdate(newLocus);
2080
+ assert.notCalled(locusInfo.clearMainSessionLocusCache)
2077
2081
  });
2078
2082
 
2079
- it('return the new locus if return to main session but no cache', () => {
2083
+ it('return the new locus if return to main session but no cache and do not clear main session cache', () => {
2080
2084
  locusInfo.mainSessionLocusCache = null;
2081
2085
  locusInfo.controls = {
2082
2086
  breakout: {
@@ -2092,10 +2096,22 @@ describe('plugin-meetings', () => {
2092
2096
  };
2093
2097
 
2094
2098
  assert.deepEqual(locusInfo.getTheLocusToUpdate(newLocus), newLocus);
2099
+
2100
+ locusInfo.clearMainSessionLocusCache = sinon.stub();
2101
+ locusInfo.getTheLocusToUpdate(newLocus);
2102
+ assert.notCalled(locusInfo.clearMainSessionLocusCache)
2095
2103
  });
2096
2104
 
2097
- it('return the new locus if not return to main session', () => {
2098
- locusInfo.mainSessionLocusCache = {url: 'url'};
2105
+ it('return the new locus if not return to main session and clear main session cache', () => {
2106
+ locusInfo.mainSessionLocusCache = {
2107
+ controls: {
2108
+ breakout: {
2109
+ sessionType: 'MAIN',
2110
+ },
2111
+ },
2112
+ self: {removed: true}
2113
+ };
2114
+ locusInfo.fullState = {state: 'ACTIVE'}
2099
2115
  locusInfo.controls = {
2100
2116
  breakout: {
2101
2117
  sessionType: 'MAIN',
@@ -2109,7 +2125,39 @@ describe('plugin-meetings', () => {
2109
2125
  },
2110
2126
  };
2111
2127
 
2112
- assert.deepEqual(locusInfo.getTheLocusToUpdate(newLocus), newLocus);
2128
+ locusInfo.clearMainSessionLocusCache = sinon.stub();
2129
+ const result = locusInfo.getTheLocusToUpdate(newLocus);
2130
+ assert.calledOnce(locusInfo.clearMainSessionLocusCache)
2131
+
2132
+ assert.deepEqual(result, newLocus);
2133
+ });
2134
+
2135
+ it('do not clear main session cache when "mainSessionLocusCache?.self?.removed" is not true', () => {
2136
+ locusInfo.mainSessionLocusCache = {
2137
+ controls: {
2138
+ breakout: {
2139
+ sessionType: 'MAIN',
2140
+ },
2141
+ },
2142
+ self: {removed: undefined}
2143
+ };
2144
+ locusInfo.fullState = {state: 'ACTIVE'}
2145
+ locusInfo.controls = {
2146
+ breakout: {
2147
+ sessionType: 'MAIN',
2148
+ },
2149
+ };
2150
+ const newLocus = {
2151
+ controls: {
2152
+ breakout: {
2153
+ sessionType: 'BREAKOUT',
2154
+ },
2155
+ },
2156
+ };
2157
+
2158
+ locusInfo.clearMainSessionLocusCache = sinon.stub();
2159
+ locusInfo.getTheLocusToUpdate(newLocus);
2160
+ assert.notCalled(locusInfo.clearMainSessionLocusCache)
2113
2161
  });
2114
2162
  });
2115
2163