@ms-cloudpack/overlay 0.17.32 → 0.17.33
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/browser-esm/lib/index.js +6 -1
- package/dist/browser-esm/lib/index.js.map +2 -2
- package/dist/browser-esm/ori-input.json +19 -19
- package/dist/browser-esm/ori-output.json +5 -5
- package/dist/browser-esm/result.json +1 -1
- package/lib/hooks/usePageLoadTimeReporter.d.ts.map +1 -1
- package/lib/hooks/usePageLoadTimeReporter.js +6 -1
- package/lib/hooks/usePageLoadTimeReporter.js.map +1 -1
- package/package.json +4 -4
|
@@ -357,7 +357,12 @@ function usePageLoadTimeReporter() {
|
|
|
357
357
|
if (!getBrowserCacheRatio) {
|
|
358
358
|
throw new Error("getBrowserCacheRatio not found on window.__cloudpack");
|
|
359
359
|
}
|
|
360
|
-
|
|
360
|
+
const browserCache = getBrowserCacheRatio();
|
|
361
|
+
await cloudpack.reportMetric.mutate({
|
|
362
|
+
metric: "BROWSER_CACHE_RATIO",
|
|
363
|
+
value: browserCache.ratio,
|
|
364
|
+
additionalProperties: { hitCount: browserCache.hit, totalCount: browserCache.total }
|
|
365
|
+
});
|
|
361
366
|
}
|
|
362
367
|
void reportPageLoadTime();
|
|
363
368
|
}, [cloudpack]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.tsx", "../../../src/components/StatusOverlay/StatusOverlay.tsx", "../../../src/components/StatusBadge/StatusBadge.tsx", "../../../src/components/StatusBadge/StatusBadge.module.css", "../../../src/components/CloudpackProvider/useStatus.ts", "../../../src/components/ErrorDialog/useErrorEvents.ts", "../../../src/hooks/usePageLoadTimeReporter.ts", "../../../src/components/ThemeProvider/ThemeProvider.tsx", "../../../src/components/ThemeProvider/ThemeProvider.module.css"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { CloudpackProvider } from './components/CloudpackProvider/CloudpackProvider.js';\nimport { StatusOverlay } from './components/StatusOverlay/StatusOverlay.js';\nimport { ThemeProvider } from './components/ThemeProvider/ThemeProvider.js';\nimport { elementIds } from './constants.js';\nimport { createCloudpackClient, reloadCountSource } from '@ms-cloudpack/api-server/browser';\n\nasync function start() {\n if (!window.__cloudpack) {\n throw new Error('Cloudpack not found on window');\n }\n\n const { pageSessionContext } = window.__cloudpack;\n\n if (!pageSessionContext) {\n throw new Error('Session context not found on window.__cloudpack');\n }\n\n const { apiUrl, currentSequence, sessionId } = pageSessionContext;\n\n const client = await createCloudpackClient({ url: apiUrl });\n\n if (sessionId === (await client.getSessionId.query())) {\n console.log('[Cloudpack] socket opened');\n }\n\n client.onDataChanged.subscribe(reloadCountSource, {\n onData: (data) => {\n if (Number(data) > currentSequence) {\n window.location.reload();\n }\n },\n });\n\n const rootDiv = document.createElement('div');\n rootDiv.id = elementIds.root;\n\n ReactDOM.render(\n <ThemeProvider>\n <CloudpackProvider client={client}>\n <StatusOverlay />\n </CloudpackProvider>\n </ThemeProvider>,\n rootDiv,\n );\n\n document.body.appendChild(rootDiv);\n}\n\nvoid start();\n", "import React, { useCallback, useState, useRef } from 'react';\nimport { StatusBadge } from '../StatusBadge/StatusBadge.js';\nimport { useStatus, type CloudpackStatus } from '../CloudpackProvider/useStatus.js';\nimport { useErrorEvents } from '../ErrorDialog/useErrorEvents.js';\nimport { usePageLoadTimeReporter } from '../../hooks/usePageLoadTimeReporter.js';\n\nconst StatusDialog = React.lazy(() => import('../StatusDialog/StatusDialog.js'));\nconst ErrorDialog = React.lazy(() => import('../ErrorDialog/ErrorDialog.js'));\n\nexport function StatusOverlay() {\n const pageLoadTime = usePageLoadTimeReporter();\n const [isExpanded, setIsExpanded] = useState<boolean>(false);\n const status = useStatus();\n const prevStatus = useRef<CloudpackStatus | undefined>();\n const { unsupported } = useErrorEvents();\n\n // If we haven't set a specific state and we become idle,\n // pop open the details if there are errors.\n React.useEffect(() => {\n if (\n !isExpanded &&\n prevStatus.current?.status !== 'idle' &&\n status.status === 'idle' &&\n (prevStatus.current?.totalErrors || 0) !== (status.totalErrors || 0)\n ) {\n setIsExpanded(true);\n }\n prevStatus.current = status;\n }, [status, isExpanded]);\n\n const toggleMinimized = useCallback(() => {\n console.log(`Toggling minimized state to ${!isExpanded}`);\n setIsExpanded(!isExpanded);\n }, [isExpanded]);\n\n const result = unsupported.length ? (\n <ErrorDialog unsupported={unsupported} />\n ) : isExpanded ? (\n <StatusDialog onClose={toggleMinimized} />\n ) : (\n <StatusBadge onExpand={toggleMinimized} pageLoadTime={pageLoadTime} />\n );\n\n return <React.Suspense fallback={null}>{result}</React.Suspense>;\n}\n", "import React, { useCallback, useRef, useState } from 'react';\nimport { useDraggable } from '../../hooks/useDraggable.js';\nimport styles from './StatusBadge.module.css';\nimport { default as cx } from 'classnames';\nimport { useStatus, type CloudpackStatus } from '../CloudpackProvider/useStatus.js';\nimport { elementIds } from '../../constants.js';\n\nexport interface StatusBadgeProps {\n inline?: boolean;\n onExpand?: () => void;\n onToggle?: () => void;\n pageLoadTime?: number;\n}\n\nexport function StatusBadge({ inline, onExpand, pageLoadTime }: StatusBadgeProps) {\n const badgeStatusKey = 'cloudpack.badgeStatus';\n\n const rootElementRef = useRef<HTMLDivElement>(null);\n const dragElementRef = useRef<HTMLDivElement>(null);\n const status = useStatus();\n const [isCollapsed, setIsCollapsed] = useState<boolean>(!!localStorage.getItem(badgeStatusKey));\n\n const shouldRender = status.status !== 'unknown';\n\n const toggleBadgeVisibility = useCallback(() => {\n const newCollapsedState = !isCollapsed;\n console.log('Status badge collapsed state:', newCollapsedState);\n setIsCollapsed(newCollapsedState);\n localStorage.setItem(badgeStatusKey, newCollapsedState ? 'collapsed' : '');\n }, [isCollapsed]);\n\n useDraggable({\n // If we're not yet able to render, don't enable dragging yet.\n // Otherwise the event handlers won't be attached when the component renders.\n enabled: shouldRender && !inline,\n containerElementRef: rootElementRef,\n dragElementRef,\n });\n\n if (!shouldRender) {\n return null;\n }\n\n const metric = pageLoadTime ? (\n <span className={styles.metric} title=\"Page Load Time\">\n in {pageLoadTime.toFixed(2)} ms\n </span>\n ) : null;\n\n const leftChevron = '\\u00AB';\n const rightChevron = '\\u00BB';\n const badge = (\n <div\n id={elementIds.statusBadgeRoot}\n ref={rootElementRef}\n className={`${getStatusClassName(status, !!inline)} ${getCollapsedClassName(isCollapsed)}`}\n >\n {!inline && (\n <div ref={dragElementRef} className={styles.gripArea}>\n <div className={styles.grip} />\n <div className={styles.grip} />\n </div>\n )}\n <button className={styles.button} onClick={onExpand} aria-label=\"Expand overlay\">\n <div className={styles.value}>{getStatusString(status)}</div>\n </button>\n <div>\n {getStatsString(status)}\n {metric}\n </div>\n <button className={`${styles.button} ${styles.chevron}`} onClick={toggleBadgeVisibility}>\n {isCollapsed ? leftChevron : rightChevron}\n </button>\n </div>\n );\n\n return inline ? (\n badge\n ) : (\n <div className={styles.fixedOverlay}>\n <div className={styles.contentSurface}>{badge}</div>\n </div>\n );\n}\n\nfunction getStatusString(status: CloudpackStatus) {\n if (status.status === 'pending') {\n return 'Running';\n }\n\n if (status.totalTasks === 0) {\n return 'Idle';\n }\n\n return status.totalErrors === 0 ? 'Success' : 'Errors';\n}\n\nfunction getStatusClassName({ status, totalTasks, totalErrors, totalWarnings }: CloudpackStatus, inline: boolean) {\n return cx(styles.badge, {\n [styles.inline]: inline,\n [styles.building]: status === 'pending',\n [styles.success]: status === 'idle' && totalTasks > 0 && totalErrors === 0 && totalWarnings === 0,\n [styles.error]: status === 'idle' && totalErrors > 0,\n [styles.warning]: status === 'idle' && totalErrors === 0 && totalWarnings > 0,\n });\n}\n\nfunction getCollapsedClassName(isCollapsed: boolean) {\n return cx(styles.badge, {\n [styles.collapsed]: isCollapsed,\n });\n}\n\nfunction getStatsString({ totalTasks, remainingTasks, totalErrors, totalWarnings }: CloudpackStatus) {\n if (totalTasks === 0) {\n return '';\n }\n\n return [\n remainingTasks > 0 && `${remainingTasks} of ${totalTasks} tasks pending`,\n remainingTasks === 0 && `${totalTasks} tasks completed`,\n totalErrors === 1 && `${totalErrors} error`,\n totalErrors > 1 && `${totalErrors} errors`,\n totalWarnings === 1 && `${totalWarnings} warning`,\n totalWarnings > 1 && `${totalWarnings} warnings`,\n ]\n .filter(Boolean)\n .join(', ');\n}\n", "// THIS FILE IS AUTO GENERATED FROM packages/overlay/src/components/StatusBadge/StatusBadge.module.css\n\n\nlet compiledModule = `.uHuWYf-StatusBadgemodule--fixedOverlay {\\n position: fixed;\\n pointer-events: none;\\n background: transparent;\\n top: 0;\\n bottom: 0;\\n left: 0;\\n right: 0;\\n z-index: 99999;\\n overflow: hidden;\\n}\\n\\n.uHuWYf-StatusBadgemodule--gripArea {\\n display: flex;\\n flex-direction: row;\\n gap: 2px;\\n height: 100%;\\n width: 12px;\\n cursor: move;\\n margin-right: -4px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--grip {\\n width: 2px;\\n height: 100%;\\n background: rgba(0, 0, 0, 0.2);\\n}\\n\\n.uHuWYf-StatusBadgemodule--contentSurface {\\n pointer-events: auto;\\n display: contents;\\n}\\n\\n.uHuWYf-StatusBadgemodule--badge {\\n position: absolute;\\n bottom: 4px;\\n right: 4px;\\n font-size: 12px;\\n display: inline-flex;\\n gap: 8px;\\n background: #dddddd;\\n box-shadow: 0 0 12px -6px rgba(0, 0, 0, 0.75);\\n border: 1px solid #999999;\\n border-radius: 4px;\\n height: 28px;\\n flex-shrink: 0;\\n justify-content: center;\\n align-items: center;\\n box-sizing: border-box;\\n padding: 3px;\\n padding-right: 8px;\\n\\n transition: background-color 0.2s ease-in-out;\\n}\\n\\n.uHuWYf-StatusBadgemodule--inline {\\n flex-shrink: 0;\\n position: relative;\\n bottom: auto;\\n right: auto;\\n top: auto;\\n left: auto;\\n box-shadow: none;\\n padding-left: 8px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--building {\\n background: #bbb;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--success {\\n background: #7ad17a;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--warning {\\n background: #e4e68b;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--error {\\n background: #ffb9b9;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--button {\\n cursor: pointer;\\n background: inherit;\\n border: none;\\n border-radius: 3px;\\n display: flex;\\n align-self: stretch;\\n align-items: center;\\n justify-content: center;\\n box-sizing: border-box;\\n padding: 0;\\n margin: 0;\\n font-weight: inherit;\\n font-size: inherit;\\n font-family: inherit;\\n}\\n\\n.uHuWYf-StatusBadgemodule--button:hover {\\n filter: invert(0.1);\\n}\\n\\n.uHuWYf-StatusBadgemodule--value {\\n font-weight: 600;\\n background: rgba(255, 255, 255, 0.4);\\n box-shadow: 2px 2px 3px -1px rgba(0, 0, 0, 0.15) inset;\\n padding: 2px 8px;\\n border-radius: 3px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--metric {\\n margin-left: 2px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--collapsed {\\n overflow: hidden;\\n padding: 0;\\n}\\n.uHuWYf-StatusBadgemodule--collapsed *:not(.uHuWYf-StatusBadgemodule--chevron) {\\n display: none;\\n}\\n\\n.uHuWYf-StatusBadgemodule--chevron {\\n padding: 0 3px;\\n}\\n`;\nconst s = document.createElement('style');\ns.setAttribute('data-sourceFile', 'packages/overlay/src/components/StatusBadge/StatusBadge.module.css');\ns.appendChild(document.createTextNode(compiledModule));\ndocument.head.appendChild(s)\nexport const badge = 'uHuWYf-StatusBadgemodule--badge';\nexport const building = 'uHuWYf-StatusBadgemodule--building';\nexport const button = 'uHuWYf-StatusBadgemodule--button';\nexport const chevron = 'uHuWYf-StatusBadgemodule--chevron';\nexport const collapsed = 'uHuWYf-StatusBadgemodule--collapsed';\nexport const contentSurface = 'uHuWYf-StatusBadgemodule--contentSurface';\nexport const error = 'uHuWYf-StatusBadgemodule--error';\nexport const fixedOverlay = 'uHuWYf-StatusBadgemodule--fixedOverlay';\nexport const grip = 'uHuWYf-StatusBadgemodule--grip';\nexport const gripArea = 'uHuWYf-StatusBadgemodule--gripArea';\nexport const inline = 'uHuWYf-StatusBadgemodule--inline';\nexport const metric = 'uHuWYf-StatusBadgemodule--metric';\nexport const success = 'uHuWYf-StatusBadgemodule--success';\nexport const value = 'uHuWYf-StatusBadgemodule--value';\nexport const warning = 'uHuWYf-StatusBadgemodule--warning';\nexport default {badge, building, button, chevron, collapsed, contentSurface, error, fixedOverlay, grip, gripArea, inline, metric, success, value, warning}\n", "import { useEffect, useState } from 'react';\nimport { useCloudpack } from './CloudpackProvider.js';\nimport { taskStatsSource, type TaskStats } from '@ms-cloudpack/api-server/browser';\n\nexport type CloudpackStatus = TaskStats;\n\nconst defaultStatus: CloudpackStatus = {\n status: 'unknown',\n remainingTasks: 0,\n totalTasks: 0,\n totalErrors: 0,\n totalWarnings: 0,\n};\n\nexport const useStatus = () => {\n const cloudpack = useCloudpack();\n const [status, setStatus] = useState<CloudpackStatus>(defaultStatus);\n\n useEffect(() => {\n const subscription = cloudpack?.onDataChanged.subscribe(taskStatsSource, {\n onData: (data) => {\n setStatus(data as CloudpackStatus);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return status;\n};\n", "import { useEffect, useState } from 'react';\nimport { parseImportString } from '@ms-cloudpack/path-string-parsing';\nimport { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';\nimport { errorEntrySource, type ErrorEntry } from '@ms-cloudpack/api-server/browser';\n\n// Interface with reason as a record.\ninterface ReasonRecord extends PromiseRejectionEvent {\n readonly reason: Record<string, unknown>;\n}\n\n// Interface with message as a string.\ninterface ReasonString extends ReasonRecord {\n readonly reason: { message: string };\n}\n\n// Verify the reason is a record.\nconst reasonIsRecord = (event: PromiseRejectionEvent): event is ReasonRecord => {\n return typeof event.reason === 'object' && !Array.isArray(event.reason) && event.reason !== null;\n};\n\n// Verify the reason has a message which is a string.\nconst hasMessage = (event: PromiseRejectionEvent): event is ReasonString => {\n return reasonIsRecord(event) && typeof event.reason.message === 'string';\n};\n\nexport type UnsupportedErrorEvent = { packageName: string; importPath: string; issuerUrl?: string; fixable?: boolean };\n\nexport const useErrorEvents = () => {\n const [errorEvents, setErrorEvents] = useState<{ unsupported: UnsupportedErrorEvent[] }>({ unsupported: [] });\n const cloudpack = useCloudpack();\n\n useEffect(() => {\n const handleUnsupportedError = (message: string, issuerUrl?: string): void => {\n const errorRegex = /[Mm]odule specifier,? ['\"](.*?)['\"]/;\n const match = message.match(errorRegex);\n\n if (match) {\n const importString = parseImportString(match[1]);\n const { packageName } = importString;\n const importPath = importString.importPath.replace(/^\\.\\//, '');\n\n (async () => {\n const { fixable } = await cloudpack.validatePackageOverride.query({ packageName, importPath, issuerUrl });\n setErrorEvents((prev) => ({\n ...prev,\n unsupported: [...prev.unsupported, { packageName, importPath, issuerUrl: issuerUrl, fixable }],\n }));\n })().catch(() => {\n // no-op\n });\n }\n };\n\n const subscription = cloudpack.onDataChanged.subscribe(errorEntrySource, {\n onData: (data) => {\n if (data) {\n console.error(data);\n handleUnsupportedError(data as ErrorEntry);\n }\n },\n });\n\n const pageErrors = window.__pageErrors;\n\n pageErrors.unregister();\n\n // Append unsupported paths to the list.\n window.addEventListener('error', (event: ErrorEvent) => {\n handleUnsupportedError(event.message, event.filename);\n });\n\n // Handle errors caught before rendering.\n for (const error of pageErrors.uncaughtErrors) {\n handleUnsupportedError(error.message, error.filename);\n }\n\n // Append unsupported paths to the list.\n window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {\n hasMessage(event) && handleUnsupportedError(event.reason.message);\n });\n\n // Handle rejections caught before rendering.\n for (const error of pageErrors.uncaughtRejections) {\n hasMessage(error) && handleUnsupportedError(error.reason.message);\n }\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return errorEvents;\n};\n", "import React from 'react';\nimport { useCloudpack } from '../components/CloudpackProvider/CloudpackProvider.js';\n\nexport function usePageLoadTimeReporter() {\n const [pageLoadTime, setPageLoadTime] = React.useState<number>();\n const cloudpack = useCloudpack();\n\n React.useEffect(() => {\n async function reportPageLoadTime() {\n if (!window.__cloudpack) {\n throw new Error('Cloudpack not found on window');\n }\n const { getPageLoadTime, getBrowserCacheRatio } = window.__cloudpack;\n\n if (!getPageLoadTime) {\n throw new Error('getPageLoadTime not found on window.__cloudpack');\n }\n const newPageLoadTime = await getPageLoadTime();\n setPageLoadTime(newPageLoadTime);\n await cloudpack.reportMetric.mutate({ metric: 'PAGE_LOAD_TIME', value: newPageLoadTime });\n\n if (!getBrowserCacheRatio) {\n throw new Error('getBrowserCacheRatio not found on window.__cloudpack');\n }\n // Page is loaded, the browser cache ratio can be reported\n await cloudpack.reportMetric.mutate({ metric: 'BROWSER_CACHE_RATIO', value: getBrowserCacheRatio() });\n }\n\n void reportPageLoadTime();\n }, [cloudpack]);\n\n return pageLoadTime;\n}\n", "import React from 'react';\nimport styles from './ThemeProvider.module.css';\n\nexport function ThemeProvider({ children }: React.ComponentProps<'div'>) {\n return <div className={styles.root}>{children}</div>;\n}\n", "// THIS FILE IS AUTO GENERATED FROM packages/overlay/src/components/ThemeProvider/ThemeProvider.module.css\n\n\nlet compiledModule = `.ASWLkl-ThemeProvidermodule--root {\\n font-family:\\n Inter,\\n -apple-system,\\n BlinkMacSystemFont,\\n 'Segoe UI',\\n Roboto,\\n Oxygen,\\n Ubuntu,\\n Cantarell,\\n 'Fira Sans',\\n 'Droid Sans',\\n 'Helvetica Neue',\\n sans-serif;\\n}\\n`;\nconst s = document.createElement('style');\ns.setAttribute('data-sourceFile', 'packages/overlay/src/components/ThemeProvider/ThemeProvider.module.css');\ns.appendChild(document.createTextNode(compiledModule));\ndocument.head.appendChild(s)\nexport const root = 'ASWLkl-ThemeProvidermodule--root';\nexport default {root}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAAA,OAAOA,YAAW;AAClB,OAAO,cAAc;;;ACDrB,OAAOC,UAAS,eAAAC,cA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AA,IAClE,CAAC;AAGD,eAAWA,UAAS,WAAW,oBAAoB;AACjD,iBAAWA,MAAK,KAAK,uBAAuBA,OAAM,OAAO,OAAO;AAAA,IAClE;AAEA,WAAO,MAAM;AACX,mBAAa,YAAY;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO;AACT;;;AC5FA,OAAOC,YAAW;AAGX,SAAS,0BAA0B;AACxC,QAAM,CAAC,cAAc,eAAe,IAAIC,OAAM,SAAiB;AAC/D,QAAM,YAAY,aAAa;AAE/B,EAAAA,OAAM,UAAU,MAAM;AACpB,mBAAe,qBAAqB;AAClC,UAAI,CAAC,OAAO,aAAa;AACvB,cAAM,IAAI,MAAM,+BAA+B;AAAA,MACjD;AACA,YAAM,EAAE,iBAAiB,qBAAqB,IAAI,OAAO;AAEzD,UAAI,CAAC,iBAAiB;AACpB,cAAM,IAAI,MAAM,iDAAiD;AAAA,MACnE;AACA,YAAM,kBAAkB,MAAM,gBAAgB;AAC9C,sBAAgB,eAAe;AAC/B,YAAM,UAAU,aAAa,OAAO,EAAE,QAAQ,kBAAkB,OAAO,gBAAgB,CAAC;AAExF,UAAI,CAAC,sBAAsB;AACzB,cAAM,IAAI,MAAM,sDAAsD;AAAA,MACxE;AAEA,YAAM,UAAU,aAAa,OAAO,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { CloudpackProvider } from './components/CloudpackProvider/CloudpackProvider.js';\nimport { StatusOverlay } from './components/StatusOverlay/StatusOverlay.js';\nimport { ThemeProvider } from './components/ThemeProvider/ThemeProvider.js';\nimport { elementIds } from './constants.js';\nimport { createCloudpackClient, reloadCountSource } from '@ms-cloudpack/api-server/browser';\n\nasync function start() {\n if (!window.__cloudpack) {\n throw new Error('Cloudpack not found on window');\n }\n\n const { pageSessionContext } = window.__cloudpack;\n\n if (!pageSessionContext) {\n throw new Error('Session context not found on window.__cloudpack');\n }\n\n const { apiUrl, currentSequence, sessionId } = pageSessionContext;\n\n const client = await createCloudpackClient({ url: apiUrl });\n\n if (sessionId === (await client.getSessionId.query())) {\n console.log('[Cloudpack] socket opened');\n }\n\n client.onDataChanged.subscribe(reloadCountSource, {\n onData: (data) => {\n if (Number(data) > currentSequence) {\n window.location.reload();\n }\n },\n });\n\n const rootDiv = document.createElement('div');\n rootDiv.id = elementIds.root;\n\n ReactDOM.render(\n <ThemeProvider>\n <CloudpackProvider client={client}>\n <StatusOverlay />\n </CloudpackProvider>\n </ThemeProvider>,\n rootDiv,\n );\n\n document.body.appendChild(rootDiv);\n}\n\nvoid start();\n", "import React, { useCallback, useState, useRef } from 'react';\nimport { StatusBadge } from '../StatusBadge/StatusBadge.js';\nimport { useStatus, type CloudpackStatus } from '../CloudpackProvider/useStatus.js';\nimport { useErrorEvents } from '../ErrorDialog/useErrorEvents.js';\nimport { usePageLoadTimeReporter } from '../../hooks/usePageLoadTimeReporter.js';\n\nconst StatusDialog = React.lazy(() => import('../StatusDialog/StatusDialog.js'));\nconst ErrorDialog = React.lazy(() => import('../ErrorDialog/ErrorDialog.js'));\n\nexport function StatusOverlay() {\n const pageLoadTime = usePageLoadTimeReporter();\n const [isExpanded, setIsExpanded] = useState<boolean>(false);\n const status = useStatus();\n const prevStatus = useRef<CloudpackStatus | undefined>();\n const { unsupported } = useErrorEvents();\n\n // If we haven't set a specific state and we become idle,\n // pop open the details if there are errors.\n React.useEffect(() => {\n if (\n !isExpanded &&\n prevStatus.current?.status !== 'idle' &&\n status.status === 'idle' &&\n (prevStatus.current?.totalErrors || 0) !== (status.totalErrors || 0)\n ) {\n setIsExpanded(true);\n }\n prevStatus.current = status;\n }, [status, isExpanded]);\n\n const toggleMinimized = useCallback(() => {\n console.log(`Toggling minimized state to ${!isExpanded}`);\n setIsExpanded(!isExpanded);\n }, [isExpanded]);\n\n const result = unsupported.length ? (\n <ErrorDialog unsupported={unsupported} />\n ) : isExpanded ? (\n <StatusDialog onClose={toggleMinimized} />\n ) : (\n <StatusBadge onExpand={toggleMinimized} pageLoadTime={pageLoadTime} />\n );\n\n return <React.Suspense fallback={null}>{result}</React.Suspense>;\n}\n", "import React, { useCallback, useRef, useState } from 'react';\nimport { useDraggable } from '../../hooks/useDraggable.js';\nimport styles from './StatusBadge.module.css';\nimport { default as cx } from 'classnames';\nimport { useStatus, type CloudpackStatus } from '../CloudpackProvider/useStatus.js';\nimport { elementIds } from '../../constants.js';\n\nexport interface StatusBadgeProps {\n inline?: boolean;\n onExpand?: () => void;\n onToggle?: () => void;\n pageLoadTime?: number;\n}\n\nexport function StatusBadge({ inline, onExpand, pageLoadTime }: StatusBadgeProps) {\n const badgeStatusKey = 'cloudpack.badgeStatus';\n\n const rootElementRef = useRef<HTMLDivElement>(null);\n const dragElementRef = useRef<HTMLDivElement>(null);\n const status = useStatus();\n const [isCollapsed, setIsCollapsed] = useState<boolean>(!!localStorage.getItem(badgeStatusKey));\n\n const shouldRender = status.status !== 'unknown';\n\n const toggleBadgeVisibility = useCallback(() => {\n const newCollapsedState = !isCollapsed;\n console.log('Status badge collapsed state:', newCollapsedState);\n setIsCollapsed(newCollapsedState);\n localStorage.setItem(badgeStatusKey, newCollapsedState ? 'collapsed' : '');\n }, [isCollapsed]);\n\n useDraggable({\n // If we're not yet able to render, don't enable dragging yet.\n // Otherwise the event handlers won't be attached when the component renders.\n enabled: shouldRender && !inline,\n containerElementRef: rootElementRef,\n dragElementRef,\n });\n\n if (!shouldRender) {\n return null;\n }\n\n const metric = pageLoadTime ? (\n <span className={styles.metric} title=\"Page Load Time\">\n in {pageLoadTime.toFixed(2)} ms\n </span>\n ) : null;\n\n const leftChevron = '\\u00AB';\n const rightChevron = '\\u00BB';\n const badge = (\n <div\n id={elementIds.statusBadgeRoot}\n ref={rootElementRef}\n className={`${getStatusClassName(status, !!inline)} ${getCollapsedClassName(isCollapsed)}`}\n >\n {!inline && (\n <div ref={dragElementRef} className={styles.gripArea}>\n <div className={styles.grip} />\n <div className={styles.grip} />\n </div>\n )}\n <button className={styles.button} onClick={onExpand} aria-label=\"Expand overlay\">\n <div className={styles.value}>{getStatusString(status)}</div>\n </button>\n <div>\n {getStatsString(status)}\n {metric}\n </div>\n <button className={`${styles.button} ${styles.chevron}`} onClick={toggleBadgeVisibility}>\n {isCollapsed ? leftChevron : rightChevron}\n </button>\n </div>\n );\n\n return inline ? (\n badge\n ) : (\n <div className={styles.fixedOverlay}>\n <div className={styles.contentSurface}>{badge}</div>\n </div>\n );\n}\n\nfunction getStatusString(status: CloudpackStatus) {\n if (status.status === 'pending') {\n return 'Running';\n }\n\n if (status.totalTasks === 0) {\n return 'Idle';\n }\n\n return status.totalErrors === 0 ? 'Success' : 'Errors';\n}\n\nfunction getStatusClassName({ status, totalTasks, totalErrors, totalWarnings }: CloudpackStatus, inline: boolean) {\n return cx(styles.badge, {\n [styles.inline]: inline,\n [styles.building]: status === 'pending',\n [styles.success]: status === 'idle' && totalTasks > 0 && totalErrors === 0 && totalWarnings === 0,\n [styles.error]: status === 'idle' && totalErrors > 0,\n [styles.warning]: status === 'idle' && totalErrors === 0 && totalWarnings > 0,\n });\n}\n\nfunction getCollapsedClassName(isCollapsed: boolean) {\n return cx(styles.badge, {\n [styles.collapsed]: isCollapsed,\n });\n}\n\nfunction getStatsString({ totalTasks, remainingTasks, totalErrors, totalWarnings }: CloudpackStatus) {\n if (totalTasks === 0) {\n return '';\n }\n\n return [\n remainingTasks > 0 && `${remainingTasks} of ${totalTasks} tasks pending`,\n remainingTasks === 0 && `${totalTasks} tasks completed`,\n totalErrors === 1 && `${totalErrors} error`,\n totalErrors > 1 && `${totalErrors} errors`,\n totalWarnings === 1 && `${totalWarnings} warning`,\n totalWarnings > 1 && `${totalWarnings} warnings`,\n ]\n .filter(Boolean)\n .join(', ');\n}\n", "// THIS FILE IS AUTO GENERATED FROM packages/overlay/src/components/StatusBadge/StatusBadge.module.css\n\n\nlet compiledModule = `.uHuWYf-StatusBadgemodule--fixedOverlay {\\n position: fixed;\\n pointer-events: none;\\n background: transparent;\\n top: 0;\\n bottom: 0;\\n left: 0;\\n right: 0;\\n z-index: 99999;\\n overflow: hidden;\\n}\\n\\n.uHuWYf-StatusBadgemodule--gripArea {\\n display: flex;\\n flex-direction: row;\\n gap: 2px;\\n height: 100%;\\n width: 12px;\\n cursor: move;\\n margin-right: -4px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--grip {\\n width: 2px;\\n height: 100%;\\n background: rgba(0, 0, 0, 0.2);\\n}\\n\\n.uHuWYf-StatusBadgemodule--contentSurface {\\n pointer-events: auto;\\n display: contents;\\n}\\n\\n.uHuWYf-StatusBadgemodule--badge {\\n position: absolute;\\n bottom: 4px;\\n right: 4px;\\n font-size: 12px;\\n display: inline-flex;\\n gap: 8px;\\n background: #dddddd;\\n box-shadow: 0 0 12px -6px rgba(0, 0, 0, 0.75);\\n border: 1px solid #999999;\\n border-radius: 4px;\\n height: 28px;\\n flex-shrink: 0;\\n justify-content: center;\\n align-items: center;\\n box-sizing: border-box;\\n padding: 3px;\\n padding-right: 8px;\\n\\n transition: background-color 0.2s ease-in-out;\\n}\\n\\n.uHuWYf-StatusBadgemodule--inline {\\n flex-shrink: 0;\\n position: relative;\\n bottom: auto;\\n right: auto;\\n top: auto;\\n left: auto;\\n box-shadow: none;\\n padding-left: 8px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--building {\\n background: #bbb;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--success {\\n background: #7ad17a;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--warning {\\n background: #e4e68b;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--error {\\n background: #ffb9b9;\\n color: #000;\\n}\\n\\n.uHuWYf-StatusBadgemodule--button {\\n cursor: pointer;\\n background: inherit;\\n border: none;\\n border-radius: 3px;\\n display: flex;\\n align-self: stretch;\\n align-items: center;\\n justify-content: center;\\n box-sizing: border-box;\\n padding: 0;\\n margin: 0;\\n font-weight: inherit;\\n font-size: inherit;\\n font-family: inherit;\\n}\\n\\n.uHuWYf-StatusBadgemodule--button:hover {\\n filter: invert(0.1);\\n}\\n\\n.uHuWYf-StatusBadgemodule--value {\\n font-weight: 600;\\n background: rgba(255, 255, 255, 0.4);\\n box-shadow: 2px 2px 3px -1px rgba(0, 0, 0, 0.15) inset;\\n padding: 2px 8px;\\n border-radius: 3px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--metric {\\n margin-left: 2px;\\n}\\n\\n.uHuWYf-StatusBadgemodule--collapsed {\\n overflow: hidden;\\n padding: 0;\\n}\\n.uHuWYf-StatusBadgemodule--collapsed *:not(.uHuWYf-StatusBadgemodule--chevron) {\\n display: none;\\n}\\n\\n.uHuWYf-StatusBadgemodule--chevron {\\n padding: 0 3px;\\n}\\n`;\nconst s = document.createElement('style');\ns.setAttribute('data-sourceFile', 'packages/overlay/src/components/StatusBadge/StatusBadge.module.css');\ns.appendChild(document.createTextNode(compiledModule));\ndocument.head.appendChild(s)\nexport const badge = 'uHuWYf-StatusBadgemodule--badge';\nexport const building = 'uHuWYf-StatusBadgemodule--building';\nexport const button = 'uHuWYf-StatusBadgemodule--button';\nexport const chevron = 'uHuWYf-StatusBadgemodule--chevron';\nexport const collapsed = 'uHuWYf-StatusBadgemodule--collapsed';\nexport const contentSurface = 'uHuWYf-StatusBadgemodule--contentSurface';\nexport const error = 'uHuWYf-StatusBadgemodule--error';\nexport const fixedOverlay = 'uHuWYf-StatusBadgemodule--fixedOverlay';\nexport const grip = 'uHuWYf-StatusBadgemodule--grip';\nexport const gripArea = 'uHuWYf-StatusBadgemodule--gripArea';\nexport const inline = 'uHuWYf-StatusBadgemodule--inline';\nexport const metric = 'uHuWYf-StatusBadgemodule--metric';\nexport const success = 'uHuWYf-StatusBadgemodule--success';\nexport const value = 'uHuWYf-StatusBadgemodule--value';\nexport const warning = 'uHuWYf-StatusBadgemodule--warning';\nexport default {badge, building, button, chevron, collapsed, contentSurface, error, fixedOverlay, grip, gripArea, inline, metric, success, value, warning}\n", "import { useEffect, useState } from 'react';\nimport { useCloudpack } from './CloudpackProvider.js';\nimport { taskStatsSource, type TaskStats } from '@ms-cloudpack/api-server/browser';\n\nexport type CloudpackStatus = TaskStats;\n\nconst defaultStatus: CloudpackStatus = {\n status: 'unknown',\n remainingTasks: 0,\n totalTasks: 0,\n totalErrors: 0,\n totalWarnings: 0,\n};\n\nexport const useStatus = () => {\n const cloudpack = useCloudpack();\n const [status, setStatus] = useState<CloudpackStatus>(defaultStatus);\n\n useEffect(() => {\n const subscription = cloudpack?.onDataChanged.subscribe(taskStatsSource, {\n onData: (data) => {\n setStatus(data as CloudpackStatus);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return status;\n};\n", "import { useEffect, useState } from 'react';\nimport { parseImportString } from '@ms-cloudpack/path-string-parsing';\nimport { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';\nimport { errorEntrySource, type ErrorEntry } from '@ms-cloudpack/api-server/browser';\n\n// Interface with reason as a record.\ninterface ReasonRecord extends PromiseRejectionEvent {\n readonly reason: Record<string, unknown>;\n}\n\n// Interface with message as a string.\ninterface ReasonString extends ReasonRecord {\n readonly reason: { message: string };\n}\n\n// Verify the reason is a record.\nconst reasonIsRecord = (event: PromiseRejectionEvent): event is ReasonRecord => {\n return typeof event.reason === 'object' && !Array.isArray(event.reason) && event.reason !== null;\n};\n\n// Verify the reason has a message which is a string.\nconst hasMessage = (event: PromiseRejectionEvent): event is ReasonString => {\n return reasonIsRecord(event) && typeof event.reason.message === 'string';\n};\n\nexport type UnsupportedErrorEvent = { packageName: string; importPath: string; issuerUrl?: string; fixable?: boolean };\n\nexport const useErrorEvents = () => {\n const [errorEvents, setErrorEvents] = useState<{ unsupported: UnsupportedErrorEvent[] }>({ unsupported: [] });\n const cloudpack = useCloudpack();\n\n useEffect(() => {\n const handleUnsupportedError = (message: string, issuerUrl?: string): void => {\n const errorRegex = /[Mm]odule specifier,? ['\"](.*?)['\"]/;\n const match = message.match(errorRegex);\n\n if (match) {\n const importString = parseImportString(match[1]);\n const { packageName } = importString;\n const importPath = importString.importPath.replace(/^\\.\\//, '');\n\n (async () => {\n const { fixable } = await cloudpack.validatePackageOverride.query({ packageName, importPath, issuerUrl });\n setErrorEvents((prev) => ({\n ...prev,\n unsupported: [...prev.unsupported, { packageName, importPath, issuerUrl: issuerUrl, fixable }],\n }));\n })().catch(() => {\n // no-op\n });\n }\n };\n\n const subscription = cloudpack.onDataChanged.subscribe(errorEntrySource, {\n onData: (data) => {\n if (data) {\n console.error(data);\n handleUnsupportedError(data as ErrorEntry);\n }\n },\n });\n\n const pageErrors = window.__pageErrors;\n\n pageErrors.unregister();\n\n // Append unsupported paths to the list.\n window.addEventListener('error', (event: ErrorEvent) => {\n handleUnsupportedError(event.message, event.filename);\n });\n\n // Handle errors caught before rendering.\n for (const error of pageErrors.uncaughtErrors) {\n handleUnsupportedError(error.message, error.filename);\n }\n\n // Append unsupported paths to the list.\n window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {\n hasMessage(event) && handleUnsupportedError(event.reason.message);\n });\n\n // Handle rejections caught before rendering.\n for (const error of pageErrors.uncaughtRejections) {\n hasMessage(error) && handleUnsupportedError(error.reason.message);\n }\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return errorEvents;\n};\n", "import React from 'react';\nimport { useCloudpack } from '../components/CloudpackProvider/CloudpackProvider.js';\n\nexport function usePageLoadTimeReporter() {\n const [pageLoadTime, setPageLoadTime] = React.useState<number>();\n const cloudpack = useCloudpack();\n\n React.useEffect(() => {\n async function reportPageLoadTime() {\n if (!window.__cloudpack) {\n throw new Error('Cloudpack not found on window');\n }\n const { getPageLoadTime, getBrowserCacheRatio } = window.__cloudpack;\n\n if (!getPageLoadTime) {\n throw new Error('getPageLoadTime not found on window.__cloudpack');\n }\n const newPageLoadTime = await getPageLoadTime();\n setPageLoadTime(newPageLoadTime);\n await cloudpack.reportMetric.mutate({ metric: 'PAGE_LOAD_TIME', value: newPageLoadTime });\n\n if (!getBrowserCacheRatio) {\n throw new Error('getBrowserCacheRatio not found on window.__cloudpack');\n }\n // Page is loaded, the browser cache ratio can be reported\n const browserCache = getBrowserCacheRatio();\n await cloudpack.reportMetric.mutate({\n metric: 'BROWSER_CACHE_RATIO',\n value: browserCache.ratio,\n additionalProperties: { hitCount: browserCache.hit, totalCount: browserCache.total },\n });\n }\n\n void reportPageLoadTime();\n }, [cloudpack]);\n\n return pageLoadTime;\n}\n", "import React from 'react';\nimport styles from './ThemeProvider.module.css';\n\nexport function ThemeProvider({ children }: React.ComponentProps<'div'>) {\n return <div className={styles.root}>{children}</div>;\n}\n", "// THIS FILE IS AUTO GENERATED FROM packages/overlay/src/components/ThemeProvider/ThemeProvider.module.css\n\n\nlet compiledModule = `.ASWLkl-ThemeProvidermodule--root {\\n font-family:\\n Inter,\\n -apple-system,\\n BlinkMacSystemFont,\\n 'Segoe UI',\\n Roboto,\\n Oxygen,\\n Ubuntu,\\n Cantarell,\\n 'Fira Sans',\\n 'Droid Sans',\\n 'Helvetica Neue',\\n sans-serif;\\n}\\n`;\nconst s = document.createElement('style');\ns.setAttribute('data-sourceFile', 'packages/overlay/src/components/ThemeProvider/ThemeProvider.module.css');\ns.appendChild(document.createTextNode(compiledModule));\ndocument.head.appendChild(s)\nexport const root = 'ASWLkl-ThemeProvidermodule--root';\nexport default {root}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAAA,OAAOA,YAAW;AAClB,OAAO,cAAc;;;ACDrB,OAAOC,UAAS,eAAAC,cAAa,YAAAC,WAAU,UAAAC,eAAc;;;ACArD,OAAO,SAAS,aAAa,QAAQ,YAAAC,iBAAgB;;;ACGrD,IAAI,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AE,KAAK,OAAO,CAAC;AAE1D,MAAI,cAAe,MAAM,OAAO,aAAa,MAAM,GAAI;AACrD,YAAQ,IAAI,2BAA2B;AAAA,EACzC;AAEA,SAAO,cAAc,UAAU,mBAAmB;AAAA,IAChD,QAAQ,CAAC,SAAS;AAChB,UAAI,OAAO,IAAI,IAAI,iBAAiB;AAClC,eAAO,SAAS,OAAO;AAAA,MACzB;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,UAAU,SAAS,cAAc,KAAK;AAC5C,UAAQ,KAAK,WAAW;AAExB,WAAS;AAAA,IACP,gBAAAC,OAAA,cAAC,qBACC,gBAAAA,OAAA,cAAC,qBAAkB,UACjB,gBAAAA,OAAA,cAAC,mBAAc,CACjB,CACF;AAAA,IACA;AAAA,EACF;AAEA,WAAS,KAAK,YAAY,OAAO;AACnC;AAEA,KAAK,MAAM;",
|
|
6
6
|
"names": ["React", "React", "useCallback", "useState", "useRef", "useState", "inline", "useState", "metric", "badge", "useEffect", "useState", "useState", "useEffect", "error", "React", "React", "React", "useState", "useRef", "useCallback", "React", "compiledModule", "s", "React", "React"]
|
|
7
7
|
}
|
|
@@ -18,24 +18,6 @@
|
|
|
18
18
|
"global": "window",
|
|
19
19
|
"process.env.NODE_ENV": "\"development\""
|
|
20
20
|
},
|
|
21
|
-
"loader": {
|
|
22
|
-
".aac": "dataurl",
|
|
23
|
-
".bmp": "dataurl",
|
|
24
|
-
".gif": "dataurl",
|
|
25
|
-
".jpeg": "dataurl",
|
|
26
|
-
".jpg": "dataurl",
|
|
27
|
-
".mp3": "dataurl",
|
|
28
|
-
".mp4": "dataurl",
|
|
29
|
-
".ogg": "dataurl",
|
|
30
|
-
".otf": "dataurl",
|
|
31
|
-
".png": "dataurl",
|
|
32
|
-
".svg": "dataurl",
|
|
33
|
-
".ttf": "dataurl",
|
|
34
|
-
".wav": "dataurl",
|
|
35
|
-
".webp": "dataurl",
|
|
36
|
-
".woff": "dataurl",
|
|
37
|
-
".woff2": "dataurl"
|
|
38
|
-
},
|
|
39
21
|
"plugins": [
|
|
40
22
|
{
|
|
41
23
|
"plugin": "css-modules",
|
|
@@ -53,5 +35,23 @@
|
|
|
53
35
|
".js",
|
|
54
36
|
".css",
|
|
55
37
|
".json"
|
|
56
|
-
]
|
|
38
|
+
],
|
|
39
|
+
"loader": {
|
|
40
|
+
".aac": "dataurl",
|
|
41
|
+
".bmp": "dataurl",
|
|
42
|
+
".gif": "dataurl",
|
|
43
|
+
".jpeg": "dataurl",
|
|
44
|
+
".jpg": "dataurl",
|
|
45
|
+
".mp3": "dataurl",
|
|
46
|
+
".mp4": "dataurl",
|
|
47
|
+
".ogg": "dataurl",
|
|
48
|
+
".otf": "dataurl",
|
|
49
|
+
".png": "dataurl",
|
|
50
|
+
".svg": "dataurl",
|
|
51
|
+
".ttf": "dataurl",
|
|
52
|
+
".wav": "dataurl",
|
|
53
|
+
".webp": "dataurl",
|
|
54
|
+
".woff": "dataurl",
|
|
55
|
+
".woff2": "dataurl"
|
|
56
|
+
}
|
|
57
57
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "builder:notify",
|
|
3
|
-
"buildId": "
|
|
3
|
+
"buildId": "build_5b035a7a-7084-4284-8bec-10e87959bb8f",
|
|
4
4
|
"buildStatus": "complete",
|
|
5
5
|
"internalError": null,
|
|
6
6
|
"warnings": [],
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"format": "esm"
|
|
146
146
|
},
|
|
147
147
|
"packages/overlay/src/hooks/usePageLoadTimeReporter.ts": {
|
|
148
|
-
"bytes":
|
|
148
|
+
"bytes": 1358,
|
|
149
149
|
"imports": [
|
|
150
150
|
{
|
|
151
151
|
"path": "react",
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
"imports": [],
|
|
636
636
|
"exports": [],
|
|
637
637
|
"inputs": {},
|
|
638
|
-
"bytes":
|
|
638
|
+
"bytes": 27090
|
|
639
639
|
},
|
|
640
640
|
"packages/overlay/dist/browser-esm/lib/index.js": {
|
|
641
641
|
"imports": [
|
|
@@ -743,7 +743,7 @@
|
|
|
743
743
|
"bytesInOutput": 2272
|
|
744
744
|
},
|
|
745
745
|
"packages/overlay/src/hooks/usePageLoadTimeReporter.ts": {
|
|
746
|
-
"bytesInOutput":
|
|
746
|
+
"bytesInOutput": 1189
|
|
747
747
|
},
|
|
748
748
|
"packages/overlay/src/components/ThemeProvider/ThemeProvider.tsx": {
|
|
749
749
|
"bytesInOutput": 176
|
|
@@ -752,7 +752,7 @@
|
|
|
752
752
|
"bytesInOutput": 599
|
|
753
753
|
}
|
|
754
754
|
},
|
|
755
|
-
"bytes":
|
|
755
|
+
"bytes": 16146
|
|
756
756
|
},
|
|
757
757
|
"packages/overlay/dist/browser-esm/chunks/js/StatusDialog-7Q5HGOOM.js.map": {
|
|
758
758
|
"imports": [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePageLoadTimeReporter.d.ts","sourceRoot":"","sources":["../../src/hooks/usePageLoadTimeReporter.ts"],"names":[],"mappings":"AAGA,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"usePageLoadTimeReporter.d.ts","sourceRoot":"","sources":["../../src/hooks/usePageLoadTimeReporter.ts"],"names":[],"mappings":"AAGA,wBAAgB,uBAAuB,uBAkCtC"}
|
|
@@ -19,7 +19,12 @@ export function usePageLoadTimeReporter() {
|
|
|
19
19
|
throw new Error('getBrowserCacheRatio not found on window.__cloudpack');
|
|
20
20
|
}
|
|
21
21
|
// Page is loaded, the browser cache ratio can be reported
|
|
22
|
-
|
|
22
|
+
const browserCache = getBrowserCacheRatio();
|
|
23
|
+
await cloudpack.reportMetric.mutate({
|
|
24
|
+
metric: 'BROWSER_CACHE_RATIO',
|
|
25
|
+
value: browserCache.ratio,
|
|
26
|
+
additionalProperties: { hitCount: browserCache.hit, totalCount: browserCache.total },
|
|
27
|
+
});
|
|
23
28
|
}
|
|
24
29
|
void reportPageLoadTime();
|
|
25
30
|
}, [cloudpack]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePageLoadTimeReporter.js","sourceRoot":"","sources":["../../src/hooks/usePageLoadTimeReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AAEpF,MAAM,UAAU,uBAAuB;IACrC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACjE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,KAAK,UAAU,kBAAkB;YAC/B,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YACD,MAAM,EAAE,eAAe,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;YAErE,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACrE,CAAC;YACD,MAAM,eAAe,GAAG,MAAM,eAAe,EAAE,CAAC;YAChD,eAAe,CAAC,eAAe,CAAC,CAAC;YACjC,MAAM,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;YAE1F,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;YACD,0DAA0D;YAC1D,MAAM,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"usePageLoadTimeReporter.js","sourceRoot":"","sources":["../../src/hooks/usePageLoadTimeReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,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AS,CAAC,CAAC,CAAC;IAEhB,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import React from 'react';\nimport { useCloudpack } from '../components/CloudpackProvider/CloudpackProvider.js';\n\nexport function usePageLoadTimeReporter() {\n const [pageLoadTime, setPageLoadTime] = React.useState<number>();\n const cloudpack = useCloudpack();\n\n React.useEffect(() => {\n async function reportPageLoadTime() {\n if (!window.__cloudpack) {\n throw new Error('Cloudpack not found on window');\n }\n const { getPageLoadTime, getBrowserCacheRatio } = window.__cloudpack;\n\n if (!getPageLoadTime) {\n throw new Error('getPageLoadTime not found on window.__cloudpack');\n }\n const newPageLoadTime = await getPageLoadTime();\n setPageLoadTime(newPageLoadTime);\n await cloudpack.reportMetric.mutate({ metric: 'PAGE_LOAD_TIME', value: newPageLoadTime });\n\n if (!getBrowserCacheRatio) {\n throw new Error('getBrowserCacheRatio not found on window.__cloudpack');\n }\n // Page is loaded, the browser cache ratio can be reported\n const browserCache = getBrowserCacheRatio();\n await cloudpack.reportMetric.mutate({\n metric: 'BROWSER_CACHE_RATIO',\n value: browserCache.ratio,\n additionalProperties: { hitCount: browserCache.hit, totalCount: browserCache.total },\n });\n }\n\n void reportPageLoadTime();\n }, [cloudpack]);\n\n return pageLoadTime;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/overlay",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.33",
|
|
4
4
|
"description": "The Cloudpack overlay ux.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"lint": "cloudpack-scripts lint"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ms-cloudpack/api-server": "^0.47.
|
|
31
|
+
"@ms-cloudpack/api-server": "^0.47.2",
|
|
32
32
|
"@ms-cloudpack/path-string-parsing": "^1.2.3",
|
|
33
33
|
"classnames": "^2.5.1",
|
|
34
34
|
"react": "^17.0.0 || ^18.0.0",
|
|
35
35
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@ms-cloudpack/common-types": "^0.
|
|
39
|
-
"@ms-cloudpack/common-types-browser": "^0.
|
|
38
|
+
"@ms-cloudpack/common-types": "^0.13.0",
|
|
39
|
+
"@ms-cloudpack/common-types-browser": "^0.3.0",
|
|
40
40
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
41
41
|
"@ms-cloudpack/scripts": "^0.0.1",
|
|
42
42
|
"@types/react": "^17.0.58",
|