From 550a229e00d7315da3b7edfaf0124c413c15b3e6 Mon Sep 17 00:00:00 2001
From: Charles Burkett <chburket@cisco.com>
Date: Tue, 19 Nov 2024 19:00:02 +0000
Subject: [PATCH 1/4] feat(consolidated-interstitial): add joinFlowVersion as
 ca event option

---
 .../internal-plugin-metrics/package.json      |  2 +-
 .../call-diagnostic-metrics.ts                |  5 +++
 .../src/metrics.types.ts                      |  3 ++
 .../call-diagnostic-metrics.ts                | 41 ++++++++++++++-----
 yarn.lock                                     | 10 ++---
 5 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/packages/@webex/internal-plugin-metrics/package.json b/packages/@webex/internal-plugin-metrics/package.json
index 002feb20183..bffd332e58d 100644
--- a/packages/@webex/internal-plugin-metrics/package.json
+++ b/packages/@webex/internal-plugin-metrics/package.json
@@ -37,7 +37,7 @@
   "dependencies": {
     "@webex/common": "workspace:*",
     "@webex/common-timers": "workspace:*",
-    "@webex/event-dictionary-ts": "^1.0.1546",
+    "@webex/event-dictionary-ts": "^1.0.1594",
     "@webex/internal-plugin-metrics": "workspace:*",
     "@webex/test-helper-chai": "workspace:*",
     "@webex/test-helper-mock-webex": "workspace:*",
diff --git a/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts
index 2a64fc5fe92..c6373b557f9 100644
--- a/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts
+++ b/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts
@@ -668,6 +668,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
       globalMeetingId,
       webexConferenceIdStr,
       sessionCorrelationId,
+      joinFlowVersion,
     } = options;
 
     // @ts-ignore
@@ -718,6 +719,10 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
       webexSubServiceType: this.getSubServiceType(meeting),
     };
 
+    if (joinFlowVersion) {
+      clientEventObject.joinFlowVersion = joinFlowVersion;
+    }
+
     return clientEventObject;
   }
 
diff --git a/packages/@webex/internal-plugin-metrics/src/metrics.types.ts b/packages/@webex/internal-plugin-metrics/src/metrics.types.ts
index a72093d4978..1946d4fcd4b 100644
--- a/packages/@webex/internal-plugin-metrics/src/metrics.types.ts
+++ b/packages/@webex/internal-plugin-metrics/src/metrics.types.ts
@@ -110,6 +110,8 @@ export type MetricEventVerb =
   | 'warn'
   | 'exit';
 
+export type MetricEventJoinFlowVersion = 'Other' | 'NewFTE';
+
 export type SubmitClientEventOptions = {
   meetingId?: string;
   mediaConnections?: any[];
@@ -123,6 +125,7 @@ export type SubmitClientEventOptions = {
   browserLaunchMethod?: BrowserLaunchMethodType;
   webexConferenceIdStr?: string;
   globalMeetingId?: string;
+  joinFlowVersion?: MetricEventJoinFlowVersion;
 };
 
 export type SubmitMQEOptions = {
diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
index bbbe37ecbf9..5299c37607f 100644
--- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
+++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
@@ -56,7 +56,7 @@ describe('internal-plugin-metrics', () => {
       id: '3',
       correlationId: 'correlationId3',
       sessionCorrelationId: 'sessionCorrelationId3',
-    }
+    };
 
     const fakeMeetings = {
       1: fakeMeeting,
@@ -103,8 +103,8 @@ describe('internal-plugin-metrics', () => {
                       return '192.168.1.90';
                     }
                   },
-                }
-              }
+                },
+              };
             },
           },
           geoHintInfo: {
@@ -1075,7 +1075,7 @@ describe('internal-plugin-metrics', () => {
           correlationId: 'correlationId',
           webexConferenceIdStr: 'webexConferenceIdStr1',
           globalMeetingId: 'globalMeetingId1',
-          sessionCorrelationId: 'sessionCorrelationId1'
+          sessionCorrelationId: 'sessionCorrelationId1',
         };
 
         cd.submitClientEvent({
@@ -1169,7 +1169,7 @@ describe('internal-plugin-metrics', () => {
           webexConferenceIdStr: 'webexConferenceIdStr1',
           globalMeetingId: 'globalMeetingId1',
           preLoginId: 'myPreLoginId',
-          sessionCorrelationId: 'sessionCorrelationId1'
+          sessionCorrelationId: 'sessionCorrelationId1',
         };
 
         cd.submitClientEvent({
@@ -1182,7 +1182,7 @@ describe('internal-plugin-metrics', () => {
           webexConferenceIdStr: 'webexConferenceIdStr1',
           globalMeetingId: 'globalMeetingId1',
           preLoginId: 'myPreLoginId',
-          sessionCorrelationId: 'sessionCorrelationId1'
+          sessionCorrelationId: 'sessionCorrelationId1',
         });
 
         assert.notCalled(generateClientEventErrorPayloadSpy);
@@ -1293,7 +1293,7 @@ describe('internal-plugin-metrics', () => {
         const options = {
           meetingId: fakeMeeting2.id,
           mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
-          sessionCorrelationId: 'sessionCorrelationId1'
+          sessionCorrelationId: 'sessionCorrelationId1',
         };
 
         cd.submitClientEvent({
@@ -1462,7 +1462,7 @@ describe('internal-plugin-metrics', () => {
                 category: 'other',
                 errorCode: 9999,
                 errorData: {
-                  errorName: 'Error'
+                  errorName: 'Error',
                 },
                 serviceErrorCode: 9999,
                 errorDescription: 'UnknownError',
@@ -1536,7 +1536,7 @@ describe('internal-plugin-metrics', () => {
                 category: 'other',
                 errorCode: 9999,
                 errorData: {
-                  errorName: 'Error'
+                  errorName: 'Error',
                 },
                 serviceErrorCode: 9999,
                 errorDescription: 'UnknownError',
@@ -1785,7 +1785,7 @@ describe('internal-plugin-metrics', () => {
           meetingId: fakeMeeting.id,
           webexConferenceIdStr: 'webexConferenceIdStr1',
           globalMeetingId: 'globalMeetingId1',
-          sessionCorrelationId: 'sessionCorrelationId1'
+          sessionCorrelationId: 'sessionCorrelationId1',
         };
 
         cd.submitMQE({
@@ -2251,7 +2251,7 @@ describe('internal-plugin-metrics', () => {
           serviceErrorCode: 9999,
           errorCode: 9999,
           errorData: {
-            errorName: 'Error'
+            errorName: 'Error',
           },
           rawErrorMessage: 'bad times',
         });
@@ -2757,6 +2757,25 @@ describe('internal-plugin-metrics', () => {
           ]);
         });
       });
+
+      it('includes expected joinFlowVersion', async () => {
+        const options = {
+          meetingId: fakeMeeting.id,
+          preLoginId: 'myPreLoginId',
+          joinFlowVersion: 'NewFTE',
+        };
+
+        const triggered = new Date();
+        const fetchOptions = await cd.buildClientEventFetchRequestOptions({
+          name: 'client.exit.app',
+          payload: {trigger: 'user-interaction', canProceed: false},
+          options,
+        });
+
+        expect(fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion).toBe(
+          options.joinFlowVersion
+        );
+      });
     });
 
     describe('#submitToCallDiagnosticsPreLogin', () => {
diff --git a/yarn.lock b/yarn.lock
index a0fe1d26df7..b8425801341 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7618,9 +7618,9 @@ __metadata:
   languageName: unknown
   linkType: soft
 
-"@webex/event-dictionary-ts@npm:^1.0.1546":
-  version: 1.0.1546
-  resolution: "@webex/event-dictionary-ts@npm:1.0.1546"
+"@webex/event-dictionary-ts@npm:^1.0.1594":
+  version: 1.0.1594
+  resolution: "@webex/event-dictionary-ts@npm:1.0.1594"
   dependencies:
     amf-client-js: ^5.2.6
     json-schema-to-typescript: ^12.0.0
@@ -7628,7 +7628,7 @@ __metadata:
     ramldt2jsonschema: ^1.2.3
     shelljs: ^0.8.5
     webapi-parser: ^0.5.0
-  checksum: d938300584c5dcdeb5924a072c20aac85e9826c9631961e604c0e1dd577172f5d11a34c0b52dbb49f86386a80ecb842446a368172e5e64c273d06903f5843fa4
+  checksum: 814a1029031bc47b7579ff52aa6ca3bc83323246e81927df5c97d531d487709befb84d2f1d7a85f9deb6ce5148eff57ee2a1d219f4568371c2c0a8b12aa167ee
   languageName: node
   linkType: hard
 
@@ -8126,7 +8126,7 @@ __metadata:
     "@webex/common": "workspace:*"
     "@webex/common-timers": "workspace:*"
     "@webex/eslint-config-legacy": "workspace:*"
-    "@webex/event-dictionary-ts": ^1.0.1546
+    "@webex/event-dictionary-ts": ^1.0.1594
     "@webex/internal-plugin-metrics": "workspace:*"
     "@webex/jest-config-legacy": "workspace:*"
     "@webex/legacy-tools": "workspace:*"

From 7ece0a8dfd12cc7f94c0e90b8e7d2fb2ba95fb1f Mon Sep 17 00:00:00 2001
From: Charles Burkett <chburket@cisco.com>
Date: Tue, 19 Nov 2024 20:02:27 +0000
Subject: [PATCH 2/4] feat(consolidated-interstitial): fixed test

---
 .../unit/spec/call-diagnostic/call-diagnostic-metrics.ts    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
index 5299c37607f..3e54421338c 100644
--- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
+++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
@@ -2772,9 +2772,9 @@ describe('internal-plugin-metrics', () => {
           options,
         });
 
-        expect(fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion).toBe(
-          options.joinFlowVersion
-        );
+        assert
+          .equal(fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion)
+          .toBe(options.joinFlowVersion);
       });
     });
 

From c944b1e86301c8f216f4b2661503518f9c6bb013 Mon Sep 17 00:00:00 2001
From: Charles Burkett <chburket@cisco.com>
Date: Tue, 19 Nov 2024 20:19:32 +0000
Subject: [PATCH 3/4] feat(consolidated-interstitial): fixed test 2

---
 .../unit/spec/call-diagnostic/call-diagnostic-metrics.ts   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
index 3e54421338c..9b4df67fee0 100644
--- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
+++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
@@ -2772,9 +2772,10 @@ describe('internal-plugin-metrics', () => {
           options,
         });
 
-        assert
-          .equal(fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion)
-          .toBe(options.joinFlowVersion);
+        assert.equal(
+          fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion,
+          options.joinFlowVersion
+        );
       });
     });
 

From cde767b9a43a28deac2309211dd80b389e02beda Mon Sep 17 00:00:00 2001
From: Charles Burkett <chburket@cisco.com>
Date: Tue, 19 Nov 2024 20:58:58 +0000
Subject: [PATCH 4/4] feat(consolidated-interstitial): addressed feedback

---
 .../call-diagnostic-metrics.ts                |  9 ++++---
 .../call-diagnostic-metrics.ts                | 25 +++++++++++++++++--
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts
index c6373b557f9..583b4b55579 100644
--- a/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts
+++ b/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts
@@ -668,7 +668,6 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
       globalMeetingId,
       webexConferenceIdStr,
       sessionCorrelationId,
-      joinFlowVersion,
     } = options;
 
     // @ts-ignore
@@ -719,8 +718,8 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
       webexSubServiceType: this.getSubServiceType(meeting),
     };
 
-    if (joinFlowVersion) {
-      clientEventObject.joinFlowVersion = joinFlowVersion;
+    if (options.joinFlowVersion) {
+      clientEventObject.joinFlowVersion = options.joinFlowVersion;
     }
 
     return clientEventObject;
@@ -766,6 +765,10 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
       loginType: this.getCurLoginType(),
     };
 
+    if (options.joinFlowVersion) {
+      clientEventObject.joinFlowVersion = options.joinFlowVersion;
+    }
+
     return clientEventObject;
   }
 
diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
index 9b4df67fee0..ceb9d5b7afe 100644
--- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
+++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts
@@ -771,7 +771,6 @@ describe('internal-plugin-metrics', () => {
           webexConferenceIdStr: undefined,
           sessionCorrelationId: undefined,
           globalMeetingId: undefined,
-          sessionCorrelationId: undefined,
         });
         assert.notCalled(generateClientEventErrorPayloadSpy);
         assert.calledWith(
@@ -2758,7 +2757,8 @@ describe('internal-plugin-metrics', () => {
         });
       });
 
-      it('includes expected joinFlowVersion', async () => {
+      it('includes expected joinFlowVersion when in-meeting', async () => {
+        // meetingId means in-meeting
         const options = {
           meetingId: fakeMeeting.id,
           preLoginId: 'myPreLoginId',
@@ -2777,6 +2777,27 @@ describe('internal-plugin-metrics', () => {
           options.joinFlowVersion
         );
       });
+
+      it('includes expected joinFlowVersion during prejoin', async () => {
+        // correlationId and no meeting id means prejoin
+        const options = {
+          correlationId: 'myCorrelationId',
+          preLoginId: 'myPreLoginId',
+          joinFlowVersion: 'NewFTE',
+        };
+
+        const triggered = new Date();
+        const fetchOptions = await cd.buildClientEventFetchRequestOptions({
+          name: 'client.exit.app',
+          payload: {trigger: 'user-interaction', canProceed: false},
+          options,
+        });
+
+        assert.equal(
+          fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion,
+          options.joinFlowVersion
+        );
+      });
     });
 
     describe('#submitToCallDiagnosticsPreLogin', () => {