@app-connect/core 1.7.12 → 1.7.16

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.
package/handlers/auth.js CHANGED
@@ -36,9 +36,9 @@ async function onOAuthCallback({ platform, hostname, tokenUrl, query, isFromMCP
36
36
  overridingOAuthOption = platformModule.getOverridingOAuthOption({ code });
37
37
  }
38
38
  const oauthApp = oauth.getOAuthApp(oauthInfo);
39
- const { accessToken, refreshToken, expires } = await oauthApp.code.getToken(callbackUri, overridingOAuthOption);
39
+ const { accessToken, refreshToken, expires, data } = await oauthApp.code.getToken(callbackUri, overridingOAuthOption);
40
40
  const authHeader = `Bearer ${accessToken}`;
41
- const { successful, platformUserInfo, returnMessage } = await platformModule.getUserInfo({ authHeader, tokenUrl, apiUrl, hostname, platform, username, callbackUri, query, proxyId, proxyConfig, userEmail });
41
+ const { successful, platformUserInfo, returnMessage } = await platformModule.getUserInfo({ authHeader, tokenUrl, apiUrl, hostname, platform, username, callbackUri, query, proxyId, proxyConfig, userEmail, data });
42
42
 
43
43
  if (successful) {
44
44
  let userInfo = null;
@@ -38,7 +38,7 @@ async function findContact({ platform, userId, phoneNumber, overridingFormat, is
38
38
  if (!isForceRefreshAccountData) {
39
39
  if (existingMatchedContactInfo) {
40
40
  console.log('found existing matched contact info in account data');
41
- return { successful: true, returnMessage: null, contact: existingMatchedContactInfo.data, extraDataTracking: null };
41
+ return { successful: true, returnMessage: null, contact: existingMatchedContactInfo.data, extraDataTracking: { isCached: true } };
42
42
  }
43
43
  }
44
44
  const proxyId = user.platformAdditionalInfo?.proxyId;
@@ -74,13 +74,12 @@ async function findContact({ platform, userId, phoneNumber, overridingFormat, is
74
74
  // save in org data
75
75
  // Danger: it does NOT support one RC account mapping to multiple CRM platforms, because contacts will be shared
76
76
  if (user.rcAccountId) {
77
- if(existingMatchedContactInfo)
78
- {
77
+ if (existingMatchedContactInfo) {
79
78
  await existingMatchedContactInfo.update({
80
79
  data: matchedContactInfo
81
80
  });
82
81
  }
83
- else{
82
+ else {
84
83
  await AccountDataModel.create({
85
84
  rcAccountId: user.rcAccountId,
86
85
  platformName: platform,
package/handlers/log.js CHANGED
@@ -129,7 +129,7 @@ async function createCallLog({ platform, userId, incomingData, hashedAccountId,
129
129
  });
130
130
  }
131
131
 
132
- const { logId, returnMessage, extraDataTracking } = await platformModule.createCallLog({
132
+ let { logId, returnMessage, extraDataTracking } = await platformModule.createCallLog({
133
133
  user,
134
134
  contactInfo,
135
135
  authHeader,
@@ -148,6 +148,11 @@ async function createCallLog({ platform, userId, incomingData, hashedAccountId,
148
148
  isFromSSCL,
149
149
  proxyConfig,
150
150
  });
151
+ if (!extraDataTracking) {
152
+ extraDataTracking = {};
153
+ }
154
+ extraDataTracking.withSmartNoteLog = !!aiNote;
155
+ extraDataTracking.withTranscript = !!transcript;
151
156
  if (logId) {
152
157
  try {
153
158
  await CallLogModel.create({
@@ -351,7 +356,7 @@ async function updateCallLog({ platform, userId, incomingData, hashedAccountId,
351
356
  });
352
357
  }
353
358
 
354
- const { updatedNote, returnMessage, extraDataTracking } = await platformModule.updateCallLog({
359
+ let { updatedNote, returnMessage, extraDataTracking } = await platformModule.updateCallLog({
355
360
  user,
356
361
  existingCallLog,
357
362
  authHeader,
@@ -377,6 +382,11 @@ async function updateCallLog({ platform, userId, incomingData, hashedAccountId,
377
382
  isFromSSCL,
378
383
  proxyConfig,
379
384
  });
385
+ if(!extraDataTracking){
386
+ extraDataTracking = {};
387
+ }
388
+ extraDataTracking.withSmartNoteLog = !!incomingData.aiNote;
389
+ extraDataTracking.withTranscript = !!incomingData.transcript;
380
390
  return { successful: true, logId: existingCallLog.thirdPartyLogId, updatedNote, returnMessage, extraDataTracking };
381
391
  }
382
392
  return { successful: false };
@@ -553,32 +563,35 @@ async function createMessageLog({ platform, userId, incomingData }) {
553
563
  conversationLogId: incomingData.logInfo.conversationLogId
554
564
  }
555
565
  });
566
+ let crmLogId = ''
556
567
  if (existingSameDateMessageLog) {
557
568
  const updateMessageResult = await platformModule.updateMessageLog({ user, contactInfo, assigneeName, ownerName, existingMessageLog: existingSameDateMessageLog, message, authHeader, additionalSubmission, imageLink, videoLink, proxyConfig });
569
+ crmLogId = existingSameDateMessageLog.thirdPartyLogId;
558
570
  returnMessage = updateMessageResult?.returnMessage;
571
+ extraDataTracking = updateMessageResult.extraDataTracking;
559
572
  }
560
573
  else {
561
574
  const createMessageLogResult = await platformModule.createMessageLog({ user, contactInfo, assigneeName, ownerName, authHeader, message, additionalSubmission, recordingLink, faxDocLink, faxDownloadLink, imageLink, imageDownloadLink, imageContentType, videoLink, proxyConfig });
562
- const crmLogId = createMessageLogResult.logId;
563
- if (crmLogId) {
564
- try {
565
- const createdMessageLog =
566
- await MessageLogModel.create({
567
- id: message.id.toString(),
568
- platform,
569
- conversationId: incomingData.logInfo.conversationId,
570
- thirdPartyLogId: crmLogId,
571
- userId,
572
- conversationLogId: incomingData.logInfo.conversationLogId
573
- });
574
- logIds.push(createdMessageLog.id);
575
- } catch (error) {
576
- return handleDatabaseError(error, 'Error creating message log');
577
- }
578
- }
575
+ crmLogId = createMessageLogResult.logId;
579
576
  returnMessage = createMessageLogResult?.returnMessage;
580
577
  extraDataTracking = createMessageLogResult.extraDataTracking;
581
578
  }
579
+ if (crmLogId) {
580
+ try {
581
+ const createdMessageLog =
582
+ await MessageLogModel.create({
583
+ id: message.id.toString(),
584
+ platform,
585
+ conversationId: incomingData.logInfo.conversationId,
586
+ thirdPartyLogId: crmLogId,
587
+ userId,
588
+ conversationLogId: incomingData.logInfo.conversationLogId
589
+ });
590
+ logIds.push(createdMessageLog.id);
591
+ } catch (error) {
592
+ return handleDatabaseError(error, 'Error creating message log');
593
+ }
594
+ }
582
595
  }
583
596
  }
584
597
  return { successful: true, logIds, returnMessage, extraDataTracking };
package/index.js CHANGED
@@ -827,7 +827,7 @@ function createCoreRouter() {
827
827
  // backward compatibility
828
828
  if(!platformName)
829
829
  {
830
- platformName = req.query.callbackUri.split('platform=')[1];
830
+ platformName = req.query.callbackUri?.split('platform=')[1] ?? state.split('platform=')[1];
831
831
  }
832
832
  // Extract mcp auth sessionId if present
833
833
  sessionId = stateParams?.get('sessionId');
@@ -1435,8 +1435,8 @@ function createCoreRouter() {
1435
1435
  }
1436
1436
  const requestEndTime = new Date().getTime();
1437
1437
  analytics.track({
1438
- eventName: 'Create call log',
1439
- interfaceName: 'createCallLog',
1438
+ eventName: 'Disposition call log',
1439
+ interfaceName: 'dispositionCallLog',
1440
1440
  connectorName: platformName,
1441
1441
  accountId: hashedAccountId,
1442
1442
  extensionId: hashedExtensionId,
package/package.json CHANGED
@@ -1,71 +1,72 @@
1
- {
2
- "name": "@app-connect/core",
3
- "version": "1.7.12",
4
- "description": "RingCentral App Connect Core",
5
- "main": "index.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/ringcentral/rc-unified-crm-extension.git"
9
- },
10
- "keywords": [
11
- "RingCentral",
12
- "App Connect"
13
- ],
14
- "author": "RingCentral Labs",
15
- "license": "MIT",
16
- "peerDependencies": {
17
- "axios": "^1.12.2",
18
- "express": "^4.22.1",
19
- "moment": "^2.29.4",
20
- "moment-timezone": "^0.5.39",
21
- "pg": "^8.8.0",
22
- "sequelize": "^6.29.0"
23
- },
24
- "dependencies": {
25
- "@aws-sdk/client-dynamodb": "^3.751.0",
26
- "@modelcontextprotocol/sdk": "^1.21.1",
27
- "@aws-sdk/client-s3": "^3.947.0",
28
- "@aws-sdk/s3-request-presigner": "^3.947.0",
29
- "body-parser": "^1.20.4",
30
- "body-parser-xml": "^2.0.5",
31
- "client-oauth2": "^4.3.3",
32
- "cors": "^2.8.5",
33
- "country-state-city": "^3.2.1",
34
- "dotenv": "^16.0.3",
35
- "dynamoose": "^4.0.3",
36
- "jsonwebtoken": "^9.0.0",
37
- "mixpanel": "^0.18.0",
38
- "shortid": "^2.2.17",
39
- "tz-lookup": "^6.1.25",
40
- "ua-parser-js": "^1.0.38"
41
- },
42
- "scripts": {
43
- "test": "jest",
44
- "test:watch": "jest --watch",
45
- "test:coverage": "jest --coverage",
46
- "test:ci": "jest --ci --coverage --watchAll=false"
47
- },
48
- "devDependencies": {
49
- "@eslint/js": "^9.22.0",
50
- "@octokit/rest": "^19.0.5",
51
- "axios": "^1.12.2",
52
- "eslint": "^9.22.0",
53
- "express": "^4.22.1",
54
- "globals": "^16.0.0",
55
- "jest": "^29.3.1",
56
- "moment": "^2.29.4",
57
- "moment-timezone": "^0.5.39",
58
- "nock": "^13.2.9",
59
- "pg": "^8.8.0",
60
- "sequelize": "^6.29.0",
61
- "sqlite3": "^5.1.2",
62
- "supertest": "^6.3.1"
63
- },
64
- "overrides": {
65
- "js-object-utilities": "2.2.1"
66
- },
67
- "bugs": {
68
- "url": "https://github.com/ringcentral/rc-unified-crm-extension/issues"
69
- },
70
- "homepage": "https://github.com/ringcentral/rc-unified-crm-extension#readme"
71
- }
1
+ {
2
+ "name": "@app-connect/core",
3
+ "version": "1.7.16",
4
+ "description": "RingCentral App Connect Core",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ringcentral/rc-unified-crm-extension.git"
9
+ },
10
+ "keywords": [
11
+ "RingCentral",
12
+ "App Connect"
13
+ ],
14
+ "author": "RingCentral Labs",
15
+ "license": "MIT",
16
+ "peerDependencies": {
17
+ "axios": "^1.12.2",
18
+ "express": "^4.22.1",
19
+ "moment": "^2.29.4",
20
+ "moment-timezone": "^0.5.39",
21
+ "pg": "^8.8.0",
22
+ "sequelize": "^6.29.0"
23
+ },
24
+ "dependencies": {
25
+ "@aws-sdk/client-dynamodb": "^3.751.0",
26
+ "@aws-sdk/client-s3": "^3.947.0",
27
+ "@aws-sdk/s3-request-presigner": "^3.947.0",
28
+ "@modelcontextprotocol/sdk": "^1.21.1",
29
+ "awesome-phonenumber": "^5.6.0",
30
+ "body-parser": "^1.20.4",
31
+ "body-parser-xml": "^2.0.5",
32
+ "client-oauth2": "^4.3.3",
33
+ "cors": "^2.8.5",
34
+ "country-state-city": "^3.2.1",
35
+ "dotenv": "^16.0.3",
36
+ "dynamoose": "^4.0.3",
37
+ "jsonwebtoken": "^9.0.0",
38
+ "mixpanel": "^0.18.0",
39
+ "shortid": "^2.2.17",
40
+ "tz-lookup": "^6.1.25",
41
+ "ua-parser-js": "^1.0.38"
42
+ },
43
+ "scripts": {
44
+ "test": "jest",
45
+ "test:watch": "jest --watch",
46
+ "test:coverage": "jest --coverage",
47
+ "test:ci": "jest --ci --coverage --watchAll=false"
48
+ },
49
+ "devDependencies": {
50
+ "@eslint/js": "^9.22.0",
51
+ "@octokit/rest": "^19.0.5",
52
+ "axios": "^1.12.2",
53
+ "eslint": "^9.22.0",
54
+ "express": "^4.22.1",
55
+ "globals": "^16.0.0",
56
+ "jest": "^29.3.1",
57
+ "moment": "^2.29.4",
58
+ "moment-timezone": "^0.5.39",
59
+ "nock": "^13.2.9",
60
+ "pg": "^8.8.0",
61
+ "sequelize": "^6.29.0",
62
+ "sqlite3": "^5.1.2",
63
+ "supertest": "^6.3.1"
64
+ },
65
+ "overrides": {
66
+ "js-object-utilities": "2.2.1"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/ringcentral/rc-unified-crm-extension/issues"
70
+ },
71
+ "homepage": "https://github.com/ringcentral/rc-unified-crm-extension#readme"
72
+ }
package/releaseNotes.json CHANGED
@@ -1,4 +1,28 @@
1
1
  {
2
+ "1.7.16": {
3
+ "global": [
4
+ {
5
+ "type": "Fix",
6
+ "description": "SMS logging issue of repeatedly logging same messages"
7
+ },
8
+ {
9
+ "type": "Fix",
10
+ "description": "Mixpanel token issue that blocks certain webpage access"
11
+ }
12
+ ]
13
+ },
14
+ "1.7.15": {
15
+ "global": [
16
+ {
17
+ "type": "Fix",
18
+ "description": "Click-to-dial injection for HTML shadow roots"
19
+ },
20
+ {
21
+ "type": "Fix",
22
+ "description": "A not-found error for user mapping"
23
+ }
24
+ ]
25
+ },
2
26
  "1.7.12": {
3
27
  "global": [
4
28
  {
@@ -175,7 +199,7 @@
175
199
  }
176
200
  ]
177
201
  },
178
- "1.6.11":{
202
+ "1.6.11": {
179
203
  "global": [
180
204
  {
181
205
  "type": "Fix",