PageSourceSearch

https://www.southcarolinablues.com/etc.clientlibs/commercial-web-p…per.min.48b500edcb73d812a0b01a34c3f0c369.js

js southcarolinablues.com collected 2026-10-02 04:29:05 UTC 6,244 bytes, 145 lines download raw bytes

1(function() {
2    const queryParams = new URLSearchParams(window.location.search);
3    const selectedReleaseTag = queryParams.get('releaseTag');
4    queryParams.delete('releaseTag');
5
6    function getCookie(cname) {
7        let name = cname + '=';
8        let decodedCookie = decodeURIComponent(document.cookie);
9        let cookies = decodedCookie.split(';');
10        for(let i = 0; i <cookies.length; i++) {
11            let cookie = cookies[i];
12            while (cookie.charAt(0) == ' ') {
13                cookie = cookie.substring(1);
14            }
15            if (cookie.indexOf(name) == 0) {
16                return cookie.substring(name.length, cookie.length);
17            }
18        }
19        return '';
20    }
21
22    function deleteCookie(cname) {
23        document.cookie = cname + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
24        console.log('Cookie is deleted --> ', cname);
25    }
26
27    function setCookie(cname, cvalue, exdays) {
28        deleteCookie(cname);
29        var expires = '';
30        if (exdays) {
31            const date = new Date();
32            date.setTime(date.getTime() + (exdays*24*60*60*1000));
33            expires = "expires="+ date.toUTCString();
34        } // exdays
35        document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
36        console.log('Cookie is created --> ', cname);
37    }
38
39    async function loadVueApp() {
40        try {
41            const commercialWebPublicApp = await useCommercialWebPublicApp();
42
43            const appContainer = document.createElement('div');
44            document.body.appendChild(appContainer);
45            commercialWebPublicApp.mount(appContainer);
46        } catch (error) {
47            console.error(error);
48        }
49
50        if (document.readyState === 'loading') {
51            window.addEventListener('DOMContentLoaded', function() {
52                loadVueComponents();
53            });
54        } else {
55            loadVueComponents();
56        }
57    }
58
59    async function loadVueComponents() {
60        for (const componentPlaceholder of document.querySelectorAll('[data-vue-cmp-is]')) {
61            (async () => {
62                const teleportTo = `#${componentPlaceholder.getAttribute('id')}`;
63                const componentName = componentPlaceholder.getAttribute('data-vue-cmp-is');
64                const componentPropsString = componentPlaceholder.getAttribute('data-vue-cmp-props') || '{}';
65                let componentProps = {};
66                try {
67                    componentProps = JSON.parse(componentPropsString);
68                } catch (error) { /* Ignore */ }
69                try {
70                    await commercialWebPublicApp.mountComponent(componentName, teleportTo, componentProps);
71                } catch (error) {
72                    document.querySelector(teleportTo).textContent
73                        = 'Specified component with the name "' + componentName + '" does not exist.';
74                    console.error(error);
75                } finally {
76                    document.querySelector(teleportTo).classList.remove('cmp-vue-component--loading');
77                }
78            })();
79        }
80    }
81
82    if (selectedReleaseTag) {
83        let webpackPublicDomain = 'https://myhealthtoolkit.com';
84        // TODO - this makes assumptions based on the tag name, which will not be possible in the future
85        // when we remove swimlanes. Need to pull the version lists for each environment.
86        if (selectedReleaseTag.includes('unit')) {
87            webpackPublicDomain = 'https://unit-1.myhealthtoolkit.com';
88        } else if (selectedReleaseTag.includes('system')) {
89            webpackPublicDomain = 'https://system-1.myhealthtoolkit.com';
90        } else if (selectedReleaseTag.includes('qa')) {
91            webpackPublicDomain = 'https://qa2.myhealthtoolkit.com';
92        }
93
94        setCookie('cwVueClientWebpackPublicDomainOverride', webpackPublicDomain);
95        setCookie('cwVueClientReleaseTag', selectedReleaseTag);
96
97        const queryParamsString = queryParams.toString();
98        window.location = window.location.origin + window.location.pathname + (queryParamsString.length > 0 ? '?' + queryParamsString : '');
99        return;
100    }
101
102    let cwVueClientWebpackPublicDomainOverride = getCookie('cwVueClientWebpackPublicDomainOverride');
103    if (!cwVueClientWebpackPublicDomainOverride) {
104        cwVueClientWebpackPublicDomainOverride = 'https://myhealthtoolkit.com';
105        setCookie('cwVueClientWebpackPublicDomainOverride', cwVueClientWebpackPublicDomainOverride);
106    }
107    let cwVueClientReleaseTag = getCookie('cwVueClientReleaseTag');
108    if (!cwVueClientReleaseTag) {
109        cwVueClientReleaseTag = 'latest';
110        setCookie('cwVueClientReleaseTag', cwVueClientReleaseTag);
111    }
112
113    const requestDomain = cwVueClientWebpackPublicDomainOverride;
114    const releaseTag = cwVueClientReleaseTag;
115
116    let vueAppBasePath = '/secure-client/commercial-web-client-public/' + releaseTag;
117    let cssBasePath = '/secure-client/commercial-web-client-css/' + releaseTag;
118
119    if (requestDomain.includes('localhost')) {
120        vueAppBasePath = '';
121        cssBasePath = '';
122    }
123
124    const vueAppUrl = requestDomain + vueAppBasePath + '/exports.js';
125    const mainStylesheetName = document.querySelector('meta[property="public:stylesheet"]')?.getAttribute('content') || 'south-carolina-blues';
126    const mainStylesheetUrl = requestDomain + cssBasePath + '/' + mainStylesheetName + '.css';
127
128    const vueAppScript = document.createElement('script');
129    vueAppScript.setAttribute('src', vueAppUrl);
130    vueAppScript.addEventListener('load', loadVueApp);
131    document.head.appendChild(vueAppScript);
132
133    const productionStylesheetLinks = document.head.querySelectorAll('link[data-main-stylesheet]');
134    if (!productionStylesheetLinks[0]?.getAttribute('href').includes(mainStylesheetUrl)) {
135        const stylesheetLink = document.createElement('link');
136        stylesheetLink.setAttribute('href', mainStylesheetUrl);
137        stylesheetLink.setAttribute('rel', 'stylesheet');
138        stylesheetLink.setAttribute('type', 'text/css');
139        document.head.appendChild(stylesheetLink);
140        for (const link of productionStylesheetLinks) {
141            link.remove();
142        }
143    }
144
145})();

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.