PageSourceSearch

https://www.thomsonreuters.ca/etc.clientlibs/emcm/components/struc…-10c35db02f29a738f6c51460a0376f1d-lc.min.js

js thomsonreuters.ca collected 2026-10-03 19:26:10 UTC 3,499 bytes, 83 lines download raw bytes

1"use strict";
2(function () {
3    // URL parameter extraction
4    let url = new URL(location);
5    let paramChltemp = url.searchParams.get("chl");
6    let paramCid = url.searchParams.get("cid");
7    let prmSfdccampaignid = url.searchParams.get("sfdccampaignid");
8    let urlString = url.toString();
9    let paramPos = urlString.indexOf("?");
10    let paramChatOrigin = '';
11    if (paramPos > 0) {
12        paramChatOrigin = urlString.substring(0, paramPos);
13    }
14    else {
15        paramChatOrigin = urlString;
16    }
17
18    let paramChl = '';
19    if (paramChltemp && (paramChltemp.toUpperCase() == 'SOC' || paramChltemp.toUpperCase() == 'SOCIAL')) {
20        paramChl = 'Social';
21    } else {
22        paramChl = paramChltemp || '';
23    }
24
25    window.addEventListener("onEmbeddedMessagingReady", function (event) {
26        // Send data to Salesforce
27        embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({ "UniqueIdentifier": "ESC_MIAW_Marketing" });
28        embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({ "Channel": paramChltemp });
29        embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({ "sfdccampaignid": prmSfdccampaignid });
30        embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({ "campaignID": paramCid });
31        embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({ "ChatOriginPage": paramChatOrigin });
32    });
33
34    // Get Salesforce config from hidden input with ternary operators for null/undefined checks
35    let chatBotConfig = document.getElementById('chat-bot-icon-salesforce');
36    let salesForceOrgId = chatBotConfig ? chatBotConfig.getAttribute('salesForceOrgId') : null;
37    let deploymentName = chatBotConfig ? chatBotConfig.getAttribute('deploymentName') : null;
38    let salesforceServiceUrl = chatBotConfig ? chatBotConfig.getAttribute('salesforceServiceUrl') : null;
39    let salesforceServicescrt2Url = chatBotConfig ? chatBotConfig.getAttribute('salesforceServicescrt2Url') : null;
40
41    function initEmbeddedMessaging() {
42        try {
43            if (!salesForceOrgId || !deploymentName || !salesforceServiceUrl || !salesforceServicescrt2Url) {
44                console.error('Missing required Salesforce configuration parameters');
45                return;
46            }
47
48            embeddedservice_bootstrap.settings.language = 'en_US'; // For example, enter 'en' or 'en-US'
49            embeddedservice_bootstrap.init(
50                salesForceOrgId,
51                deploymentName,
52                salesforceServiceUrl,
53                {
54                    scrt2URL: salesforceServicescrt2Url
55                }
56            );
57        } catch (err) {
58            console.error('Error loading Embedded Messaging: ', err);
59        }
60    }
61
62    // Load the bootstrap script
63    document.addEventListener("DOMContentLoaded", function () {
64        // Guard against the double load of the Salesforce MIAW bootstrap
65        if (window.trMiawBootstrapRequested) {
66            return;
67        }
68        window.trMiawBootstrapRequested = true;
69
70        if (!salesforceServiceUrl) {
71            console.error('Cannot load bootstrap script: Salesforce service URL is missing');
72            return;
73        }
74
75        let script = document.createElement('script');
76        script.type = 'text/javascript';
77        script.src = salesforceServiceUrl + '/assets/js/bootstrap.min.js';
78        script.onload = function () {
79            initEmbeddedMessaging();
80        };
81        document.head.appendChild(script);
82    });
83})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.