Skip to content

Commit 0da1b9f

Browse files
committed
Updated to include external link
1 parent 243d24d commit 0da1b9f

File tree

10 files changed

+29
-20
lines changed

10 files changed

+29
-20
lines changed

packages/auth/src/api/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ export async function _performFetchWithErrorHandling<V>(
198198
customErrorMap: Partial<ServerErrorMap<ServerError>>,
199199
fetchFn: () => Promise<Response>
200200
): Promise<V> {
201-
const authInternal = auth as AuthInternal;
202-
authInternal._canInitEmulator = false;
201+
(auth as AuthInternal)._canInitEmulator = false;
203202
const errorMap = { ...SERVER_ERROR_MAP, ...customErrorMap };
204203
try {
205204
const networkTimeout = new NetworkTimeout<Response>(auth);

packages/auth/src/core/auth/emulator.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,12 @@ export function connectAuthEmulator(
102102
authInternal.emulatorConfig = emulatorConfig;
103103
authInternal.settings.appVerificationDisabledForTesting = true;
104104

105-
if (!disableWarnings) {
106-
if (isCloudWorkstation(host)) {
107-
updateEmulatorBanner('Auth', true);
108-
} else {
109-
emitEmulatorWarning();
110-
}
111-
}
112-
113-
// Workaround to get cookies in Firebase Studio
114105
if (isCloudWorkstation(host)) {
106+
updateEmulatorBanner('Auth', true);
107+
// Workaround to get cookies in Firebase Studio
115108
void pingServer(`${protocol}//${host}${portStr}`);
109+
} else if (!disableWarnings) {
110+
emitEmulatorWarning();
116111
}
117112
}
118113

packages/auth/src/platform_browser/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {
111111
}
112112
}
113113

114-
updateEmulatorBanner('Auth', false);
115-
116114
const authEmulatorHost = getDefaultEmulatorHost('auth');
117115
if (authEmulatorHost) {
118116
connectAuthEmulator(auth, `http://${authEmulatorHost}`);

packages/database/src/api/Database.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ export function getDatabase(
333333
identifier: url
334334
}) as Database;
335335
if (!db._instanceStarted) {
336-
updateEmulatorBanner('Database', false);
337336
const emulator = getDefaultEmulatorHostnameAndPort('database');
338337
if (emulator) {
339338
connectDatabaseEmulator(db, ...emulator);

packages/firestore/src/util/async_queue_impl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export class AsyncQueueImpl implements AsyncQueue {
182182
}
183183

184184
private enqueueInternal<T extends unknown>(op: () => Promise<T>): Promise<T> {
185+
console.trace();
185186
const newTail = this.tail.then(() => {
186187
this.operationInProgress = true;
187188
return op()

packages/functions/src/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export function getFunctions(
4848
app: FirebaseApp = getApp(),
4949
regionOrCustomDomain: string = DEFAULT_REGION
5050
): Functions {
51-
updateEmulatorBanner('Functions', false);
5251
// Dependencies
5352
const functionsProvider: Provider<'functions'> = _getProvider(
5453
getModularInstance(app),

packages/functions/src/service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ export function httpsCallable<RequestData, ResponseData, StreamData = unknown>(
200200
name: string,
201201
options?: HttpsCallableOptions
202202
): HttpsCallable<RequestData, ResponseData, StreamData> {
203-
updateEmulatorBanner('Functions', functionsInstance.emulatorOrigin !== null);
204203
const callable = (
205204
data?: RequestData | null
206205
): Promise<HttpsCallableResult> => {
@@ -231,7 +230,6 @@ export function httpsCallableFromURL<
231230
url: string,
232231
options?: HttpsCallableOptions
233232
): HttpsCallable<RequestData, ResponseData, StreamData> {
234-
updateEmulatorBanner('Functions', functionsInstance.emulatorOrigin !== null);
235233
const callable = (
236234
data?: RequestData | null
237235
): Promise<HttpsCallableResult> => {

packages/storage/src/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ export function getStorage(
333333
bucketUrl?: string
334334
): FirebaseStorage {
335335
app = getModularInstance(app);
336-
updateEmulatorBanner('Storage', false);
337336
const storageProvider: Provider<'storage'> = _getProvider(app, STORAGE_TYPE);
338337
const storageInstance = storageProvider.getImmediate({
339338
identifier: bucketUrl

packages/storage/src/service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ export class FirebaseStorageImpl implements FirebaseStorage {
326326
appCheckToken: string | null,
327327
retry = true
328328
): Request<O> {
329-
updateEmulatorBanner('Service', this._isUsingEmulator);
330329
if (!this._deleted) {
331330
const request = makeRequest(
332331
requestInfo,

packages/util/src/emulator.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,15 @@ export function updateEmulatorBanner(
261261
learnMoreLink.style.paddingLeft = '5px';
262262
}
263263

264+
function setupOpenExternal(svgElement: SVGElement, id: string): void {
265+
svgElement.setAttribute('viewBox', '0 0 16 16');
266+
svgElement.setAttribute('fill', 'none');
267+
svgElement.setAttribute('id', id);
268+
svgElement.style.width = '16px';
269+
svgElement.style.marginLeft = '4px';
270+
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"/>`;
271+
}
272+
264273
function setupDom(): void {
265274
const banner = getOrCreateEl(bannerId);
266275
const firebaseTextId = prefixedId('text');
@@ -276,14 +285,27 @@ export function updateEmulatorBanner(
276285
prependIconId
277286
) as HTMLOrSVGElement as SVGElement) ||
278287
document.createElementNS('http://www.w3.org/2000/svg', 'svg');
288+
const openExternalIconId = prefixedId('openexternal');
289+
const openExternalIcon: SVGElement =
290+
(document.getElementById(
291+
openExternalIconId
292+
) as HTMLOrSVGElement as SVGElement) ||
293+
document.createElementNS('http://www.w3.org/2000/svg', 'svg');
279294
if (banner.created) {
280295
// update styles
281296
const bannerEl = banner.element;
282297
setupBannerStyles(bannerEl);
283298
setupLinkStyles(learnMoreLink, learnMoreId);
299+
setupOpenExternal(openExternalIcon, openExternalIconId);
284300
const closeBtn = setupCloseBtn();
285301
setupIconStyles(prependIcon, prependIconId);
286-
bannerEl.append(prependIcon, firebaseText, learnMoreLink, closeBtn);
302+
bannerEl.append(
303+
prependIcon,
304+
firebaseText,
305+
learnMoreLink,
306+
openExternalIcon,
307+
closeBtn
308+
);
287309
document.body.appendChild(bannerEl);
288310
}
289311

0 commit comments

Comments
 (0)