@firebase/util 1.11.0-firebase-studio-sdk-integration.9de25069c → 1.11.0-firebase-studio-sdk-integration.927daddb8
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/dist/index.cjs.js +92 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +92 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +92 -0
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +92 -1
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/emulator.d.ts +7 -0
- package/dist/src/emulator.d.ts +7 -0
- package/dist/util-public.d.ts +8 -0
- package/dist/util.d.ts +8 -0
- package/package.json +1 -1
|
@@ -712,6 +712,97 @@ function createMockUserToken(token, projectId) {
|
|
|
712
712
|
signature
|
|
713
713
|
].join('.');
|
|
714
714
|
}
|
|
715
|
+
const emulatorStatus = {};
|
|
716
|
+
// Checks whether any products are running on an emulator
|
|
717
|
+
function getEmulatorSummary() {
|
|
718
|
+
const summary = {
|
|
719
|
+
prod: [],
|
|
720
|
+
emulator: []
|
|
721
|
+
};
|
|
722
|
+
for (const key of Object.keys(emulatorStatus)) {
|
|
723
|
+
if (emulatorStatus[key]) {
|
|
724
|
+
summary.emulator.push(key);
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
summary.prod.push(key);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return summary;
|
|
731
|
+
}
|
|
732
|
+
function getOrCreateEl(id) {
|
|
733
|
+
let parentDiv = document.getElementById(id);
|
|
734
|
+
let created = false;
|
|
735
|
+
if (!parentDiv) {
|
|
736
|
+
parentDiv = document.createElement('div');
|
|
737
|
+
parentDiv.setAttribute('id', id);
|
|
738
|
+
created = true;
|
|
739
|
+
}
|
|
740
|
+
return { created, element: parentDiv };
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Updates Emulator Banner. Primarily used for Firebase Studio
|
|
744
|
+
* @param name
|
|
745
|
+
* @param isRunningEmulator
|
|
746
|
+
* @public
|
|
747
|
+
*/
|
|
748
|
+
function updateEmulatorBanner(name, isRunningEmulator) {
|
|
749
|
+
if (typeof window === 'undefined' ||
|
|
750
|
+
typeof document === 'undefined' ||
|
|
751
|
+
emulatorStatus[name] === isRunningEmulator) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
emulatorStatus[name] = isRunningEmulator;
|
|
755
|
+
const bannerId = '__firebase__banner';
|
|
756
|
+
const summary = getEmulatorSummary();
|
|
757
|
+
const showError = summary.prod.length > 0;
|
|
758
|
+
function tearDown() {
|
|
759
|
+
const element = document.getElementById(bannerId);
|
|
760
|
+
if (element) {
|
|
761
|
+
element.remove();
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
function setupDom() {
|
|
765
|
+
const banner = getOrCreateEl(bannerId);
|
|
766
|
+
const firebaseText = document.getElementById('__firebase__text') ||
|
|
767
|
+
document.createElement('span');
|
|
768
|
+
if (banner.created) {
|
|
769
|
+
// update styles
|
|
770
|
+
const bannerEl = banner.element;
|
|
771
|
+
bannerEl.style.display = 'flex';
|
|
772
|
+
bannerEl.style.background = '#7faaf0';
|
|
773
|
+
bannerEl.style.position = 'absolute';
|
|
774
|
+
bannerEl.style.bottom = '5px';
|
|
775
|
+
bannerEl.style.left = '5px';
|
|
776
|
+
bannerEl.style.padding = '.5em';
|
|
777
|
+
bannerEl.style.borderRadius = '5px';
|
|
778
|
+
bannerEl.style.alignContent = 'center';
|
|
779
|
+
const closeBtn = document.createElement('span');
|
|
780
|
+
closeBtn.style.cursor = 'pointer';
|
|
781
|
+
closeBtn.style.paddingLeft = '5px';
|
|
782
|
+
closeBtn.innerHTML = ' ×';
|
|
783
|
+
closeBtn.onclick = () => {
|
|
784
|
+
tearDown();
|
|
785
|
+
};
|
|
786
|
+
bannerEl.appendChild(firebaseText);
|
|
787
|
+
bannerEl.appendChild(closeBtn);
|
|
788
|
+
document.body.appendChild(bannerEl);
|
|
789
|
+
}
|
|
790
|
+
if (showError) {
|
|
791
|
+
banner.element.style.background = '#cd5c5c';
|
|
792
|
+
firebaseText.innerText = `Product${summary.prod.length > 0 ? 's' : ''} Running in Production: ${summary.prod.join(', ')}`;
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
firebaseText.innerText = 'Running in this workspace';
|
|
796
|
+
}
|
|
797
|
+
firebaseText.setAttribute('id', '__firebase__text');
|
|
798
|
+
}
|
|
799
|
+
if (document.readyState === 'loading') {
|
|
800
|
+
window.addEventListener('DOMContentLoaded', setupDom);
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
setupDom();
|
|
804
|
+
}
|
|
805
|
+
}
|
|
715
806
|
|
|
716
807
|
/**
|
|
717
808
|
* @license
|
|
@@ -2159,5 +2250,5 @@ async function pingServer(endpoint) {
|
|
|
2159
2250
|
// Overriding the constant (we should be the only ones doing this)
|
|
2160
2251
|
CONSTANTS.NODE_CLIENT = true;
|
|
2161
2252
|
|
|
2162
|
-
export { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isCloudWorkstation, isCloudflareWorker, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, pingServer, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
2253
|
+
export { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isCloudWorkstation, isCloudflareWorker, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, pingServer, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, updateEmulatorBanner, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
2163
2254
|
//# sourceMappingURL=index.node.esm.js.map
|