@firebase/util 1.11.0-firebase-studio-sdk-integration.fe1264c00 → 1.11.0-firebase-studio-sdk-integration.a528caf5f

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 CHANGED
@@ -790,6 +790,7 @@ function updateEmulatorBanner(name, isRunningEmulator) {
790
790
  typeof document === 'undefined' ||
791
791
  !isCloudWorkstation(window.location.host) ||
792
792
  emulatorStatus[name] === isRunningEmulator ||
793
+ emulatorStatus[name] || // If already set to use emulator, can't go back to prod.
793
794
  previouslyDismissed) {
794
795
  return;
795
796
  }
@@ -806,6 +807,51 @@ function updateEmulatorBanner(name, isRunningEmulator) {
806
807
  element.remove();
807
808
  }
808
809
  }
810
+ function setupBannerStyles(bannerEl) {
811
+ bannerEl.style.display = 'flex';
812
+ bannerEl.style.background = '#7faaf0';
813
+ bannerEl.style.position = 'absolute';
814
+ bannerEl.style.bottom = '5px';
815
+ bannerEl.style.left = '5px';
816
+ bannerEl.style.padding = '.5em';
817
+ bannerEl.style.borderRadius = '5px';
818
+ bannerEl.style.alignContent = 'center';
819
+ }
820
+ function setupIconStyles(prependIcon, iconId) {
821
+ prependIcon.setAttribute('width', '24');
822
+ prependIcon.setAttribute('id', iconId);
823
+ prependIcon.setAttribute('height', '24');
824
+ prependIcon.setAttribute('viewBox', '0 0 24 24');
825
+ prependIcon.setAttribute('fill', 'none');
826
+ prependIcon.style.marginLeft = '-6px';
827
+ }
828
+ function setupCloseBtn() {
829
+ const closeBtn = document.createElement('span');
830
+ closeBtn.style.cursor = 'pointer';
831
+ closeBtn.style.paddingLeft = '5px';
832
+ closeBtn.innerHTML = ' ×';
833
+ closeBtn.onclick = () => {
834
+ previouslyDismissed = true;
835
+ tearDown();
836
+ };
837
+ return closeBtn;
838
+ }
839
+ function setupLinkStyles(learnMoreLink, learnMoreId) {
840
+ learnMoreLink.setAttribute('id', learnMoreId);
841
+ learnMoreLink.innerText = 'Learn more';
842
+ learnMoreLink.href =
843
+ 'http://firebase.google.com/docs/studio/deploy-app#emulator ';
844
+ learnMoreLink.setAttribute('target', '__blank');
845
+ learnMoreLink.style.paddingLeft = '5px';
846
+ }
847
+ function setupOpenExternal(svgElement, id) {
848
+ svgElement.setAttribute('viewBox', '0 0 16 16');
849
+ svgElement.setAttribute('fill', 'none');
850
+ svgElement.setAttribute('id', id);
851
+ svgElement.style.width = '16px';
852
+ svgElement.style.marginLeft = '4px';
853
+ svgElement.innerHTML = `<path fill-rule="evenodd" clip-rule="evenodd" d="M12.6667 12.6667H3.33333V3.33333H8V2H3.33333C2.59333 2 2 2.6 2 3.33333V12.6667C2 13.4 2.59333 14 3.33333 14H12.6667C13.4 14 14 13.4 14 12.6667V8H12.6667V12.6667ZM9.33333 2V3.33333H11.7267L5.17333 9.88667L6.11333 10.8267L12.6667 4.27333V6.66667H14V2H9.33333Z" fill="#212121"/>`;
854
+ }
809
855
  function setupDom() {
810
856
  const banner = getOrCreateEl(bannerId);
811
857
  const firebaseTextId = prefixedId('text');
@@ -816,41 +862,22 @@ function updateEmulatorBanner(name, isRunningEmulator) {
816
862
  const prependIconId = prefixedId('preprendIcon');
817
863
  const prependIcon = document.getElementById(prependIconId) ||
818
864
  document.createElementNS('http://www.w3.org/2000/svg', 'svg');
865
+ const openExternalIconId = prefixedId('openexternal');
866
+ const openExternalIcon = document.getElementById(openExternalIconId) ||
867
+ document.createElementNS('http://www.w3.org/2000/svg', 'svg');
819
868
  if (banner.created) {
820
869
  // update styles
821
870
  const bannerEl = banner.element;
822
- bannerEl.style.display = 'flex';
823
- bannerEl.style.background = '#7faaf0';
824
- bannerEl.style.position = 'absolute';
825
- bannerEl.style.bottom = '5px';
826
- bannerEl.style.left = '5px';
827
- bannerEl.style.padding = '.5em';
828
- bannerEl.style.borderRadius = '5px';
829
- bannerEl.style.alignContent = 'center';
830
- const closeBtn = document.createElement('span');
831
- closeBtn.style.cursor = 'pointer';
832
- closeBtn.style.paddingLeft = '5px';
833
- closeBtn.innerHTML = ' &times;';
834
- closeBtn.onclick = () => {
835
- previouslyDismissed = true;
836
- tearDown();
837
- };
838
- learnMoreLink.setAttribute('id', learnMoreId);
839
- learnMoreLink.href =
840
- 'http://firebase.google.com/docs/studio/deploy-app#emulator ';
841
- bannerEl.appendChild(prependIcon);
842
- bannerEl.appendChild(firebaseText);
843
- bannerEl.appendChild(learnMoreLink);
844
- bannerEl.appendChild(closeBtn);
845
- prependIcon.setAttribute('width', '24');
846
- prependIcon.setAttribute('id', prependIconId);
847
- prependIcon.setAttribute('height', '24');
848
- prependIcon.setAttribute('viewBox', '0 0 24 24');
849
- prependIcon.setAttribute('fill', 'none');
871
+ setupBannerStyles(bannerEl);
872
+ setupLinkStyles(learnMoreLink, learnMoreId);
873
+ setupOpenExternal(openExternalIcon, openExternalIconId);
874
+ const closeBtn = setupCloseBtn();
875
+ setupIconStyles(prependIcon, prependIconId);
876
+ bannerEl.append(prependIcon, firebaseText, learnMoreLink, openExternalIcon, closeBtn);
850
877
  document.body.appendChild(bannerEl);
851
878
  }
852
879
  if (showError) {
853
- firebaseText.innerText = `Running in Production`;
880
+ firebaseText.innerText = `Not using emulated backend.`;
854
881
  prependIcon.innerHTML = `<g clip-path="url(#clip0_6013_33858)">
855
882
  <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
856
883
  </g>
@@ -870,8 +897,6 @@ function updateEmulatorBanner(name, isRunningEmulator) {
870
897
  </clipPath>
871
898
  </defs>`;
872
899
  firebaseText.innerText = 'Using emulated backend';
873
- learnMoreLink.href =
874
- 'https://firebase.google.com/docs/studio/solution-build-with-ai';
875
900
  }
876
901
  firebaseText.setAttribute('id', firebaseTextId);
877
902
  }