From 514c8365eaccb725278e176b57aa85b7b9ac7aec Mon Sep 17 00:00:00 2001 From: Mir Date: Tue, 20 Jun 2023 13:15:18 +0000 Subject: [PATCH 1/4] Introduce nicHomeURL as it may be different from customer to customer --- main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 2402f23..e05a092 100644 --- a/main.js +++ b/main.js @@ -5,6 +5,7 @@ * showLiveChatButton * showVideoChatButton * scaleDroneChannelId + * nicHomeURL * nicBusNumber * nicChatPOC * clusterNiC @@ -27,6 +28,7 @@ * var showLiveChatButton = true; * var showVideoChatButton = true; * var scaleDroneChannelId = 'fygLrCqVZUYQZL6'; + * var nicHomeURL = 'https://home-b99.nice-incontact.com'; * var nicBusNumber = '1809119'; * var nicChatPOC = '1605d121-489c-4df4-83b1-334dbeb0a781u'; * var clusterNiC = 'b99'; @@ -44,7 +46,7 @@ * */ -let NicHomeURL = "https://home-" + clusterNiC + ".nice-incontact.com"; +var nicHomeURL = nicHomeURL || "https://home-" + clusterNiC + ".nice-incontact.com"; var showLiveChatButton = typeof showLiveChatButton === 'undefined' ? true : showLiveChatButton; var showVideoChatButton = typeof showVideoChatButton === 'undefined' ? true : showVideoChatButton; @@ -55,7 +57,7 @@ if (showLiveChatButton === false && showVideoChatButton === false) { }; var chatSrc = document.createElement("script"); -chatSrc.src = NicHomeURL + "/inContact/ChatClient/js/embed.min.js"; +chatSrc.src = nicHomeURL + "/inContact/ChatClient/js/embed.min.js"; var head = document.getElementsByTagName("head")[0]; head.appendChild(chatSrc); @@ -346,7 +348,7 @@ function loadSurfly() { function initializeChatNiC() { icPatronChat.init({ - serverHost: NicHomeURL, + serverHost: nicHomeURL, bus_no: nicBusNumber, poc: nicChatPOC, params: [localStorage.getItem(nicBusNumber + "-uniquePageId")] From f1c208a36abf8926b2a570c3e743a344a74a2032 Mon Sep 17 00:00:00 2001 From: Mir Date: Tue, 20 Jun 2023 13:20:19 +0000 Subject: [PATCH 2/4] Add `composer.json` to enforce heroku to identify it as a PHP app We'd like to deploy this static app to heroku and use it. the only way to do it is to add composer.json file to it so heroku categorise it as a PHP app that can serve files. --- composer.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/composer.json @@ -0,0 +1 @@ +{} \ No newline at end of file From 4781bea30ca9ef8928440d1b9b6ccb6e2d8b07fb Mon Sep 17 00:00:00 2001 From: Mir Date: Tue, 20 Jun 2023 13:34:18 +0000 Subject: [PATCH 3/4] Use startLeader instad of create as it is more convenient and readable --- main.js | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/main.js b/main.js index e05a092..99e165f 100644 --- a/main.js +++ b/main.js @@ -134,10 +134,7 @@ function createVideochatSession() { "name": "Customer" }; - videochatSession.on("session_created", function(session, event) { - console.log('Waiting for confirmation'); - session.startLeader(null, surflyMetadata); - }).on("session_started", function(session, event) { + videochatSession.on("session_started", function(session, event) { var surflySessionPin = session.pin; var surflyFollowerLink = session.followerLink; signalWorkItem(surflyFollowerLink); @@ -149,7 +146,7 @@ function createVideochatSession() { console.log("Videochat session ended"); showVideoChatButton && createVideochatButton(); endWorkItem(window.nicVideochatContactId); - }).create(); + }).startLeader(null, surflyMetadata) } @@ -175,15 +172,10 @@ function createSurflySession(contactId, inviteType) { var regularSession = Surfly.session({ block_until_agent_joins: false }); - regularSession.on("session_created", function(session, event) { - console.log('Waiting for confirmation'); - session.startLeader(null, surflyMetadata); - }).on("session_started", function(session, event) { + regularSession.on("session_started", function(session, event) { var surflySessionPin = session.pin; var surflyFollowerLink = session.followerLink; - signalContact(contactId, surflyFollowerLink, surflySessionPin, 'cobrowse'); - var chatDiv = document.getElementById("chat-div-wrap"); chatDiv.style.zIndex = "2147483549"; console.log('Session Pin: ' + surflySessionPin); @@ -192,24 +184,18 @@ function createSurflySession(contactId, inviteType) { console.log("Regular session ended, updating Studio"); updateStudioScript(contactId, 'cobrowse'); showVideoChatButton && createVideochatButton(); - }).create(); + }).startLeader(null, surflyMetadata); } else if (inviteType == 'videochat') { var regularSession = Surfly.session({ block_until_agent_joins: false, videochat_autostart: true, videochat_start_fullscreen: true }); - regularSession.on("session_created", function(session, event) { - console.log('Waiting for confirmation'); - session.startLeader(null, surflyMetadata); - }).on("session_started", function(session, event) { + regularSession.on("session_started", function(session, event) { var surflySessionPin = session.pin; var surflyFollowerLink = session.followerLink; - signalContact(contactId, surflyFollowerLink, surflySessionPin, 'videochat'); - var chatDiv = document.getElementById("chat-div-wrap"); - chatDiv.style.zIndex = "2147483549"; console.log('Session Pin: ' + surflySessionPin); console.log('Contact ID: ' + contactId); @@ -217,7 +203,7 @@ function createSurflySession(contactId, inviteType) { console.log("Regular session ended, updating Studio"); updateStudioScript(contactId, 'videochat'); showVideoChatButton && createVideochatButton(); - }).create(); + }).startLeader(null, surflyMetadata); } } From b8cdf8bd4fd3b637394e349726cddcb385a2b7a7 Mon Sep 17 00:00:00 2001 From: Mir Date: Tue, 20 Jun 2023 13:45:35 +0000 Subject: [PATCH 4/4] Add pr template --- .github/workflows/pull_request_template.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md new file mode 100644 index 0000000..23818b6 --- /dev/null +++ b/.github/workflows/pull_request_template.md @@ -0,0 +1,14 @@ +Fixes surfly/it#ISSUE_NUMBER + +#### Description + +--- + +#### Before requesting the review, make sure you've: +- updated all related docs +- written tests for any new functionality +- verified commit history + +#### The pr is ready! +- [ ] all tests are passing +- [ ] I tested my changes and it works!