@ms-cloudpack/overlay 0.0.2
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/CHANGELOG.json +20 -0
- package/CHANGELOG.md +13 -0
- package/lib/components/StatusBadge/StatusBadge.d.ts +1 -0
- package/lib/components/StatusBadge/StatusBadge.js +32 -0
- package/lib/components/StatusBadge/StatusBadge.js.map +1 -0
- package/lib/components/StatusBadge/StatusBadge.types.d.ts +1 -0
- package/lib/components/StatusBadge/StatusBadge.types.js +2 -0
- package/lib/components/StatusBadge/StatusBadge.types.js.map +1 -0
- package/lib/components/StatusBadge/getStatusText.d.ts +2 -0
- package/lib/components/StatusBadge/getStatusText.js +19 -0
- package/lib/components/StatusBadge/getStatusText.js.map +1 -0
- package/lib/components/StatusProvider/StatusProvider.d.ts +12 -0
- package/lib/components/StatusProvider/StatusProvider.js +50 -0
- package/lib/components/StatusProvider/StatusProvider.js.map +1 -0
- package/lib/components/StatusProvider/getCookies.d.ts +1 -0
- package/lib/components/StatusProvider/getCookies.js +10 -0
- package/lib/components/StatusProvider/getCookies.js.map +1 -0
- package/lib/components/StatusProvider/useStatus.d.ts +1 -0
- package/lib/components/StatusProvider/useStatus.js +4 -0
- package/lib/components/StatusProvider/useStatus.js.map +1 -0
- package/lib/hooks/useDraggable.d.ts +4 -0
- package/lib/hooks/useDraggable.js +46 -0
- package/lib/hooks/useDraggable.js.map +1 -0
- package/lib/hooks/useSessionId.d.ts +1 -0
- package/lib/hooks/useSessionId.js +14 -0
- package/lib/hooks/useSessionId.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +34 -0
package/CHANGELOG.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ms-cloudpack/overlay",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Tue, 02 Aug 2022 19:53:43 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/overlay_v0.0.2",
|
|
7
|
+
"version": "0.0.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/overlay",
|
|
13
|
+
"commit": "8b05563fd078c4a19d77a2be999587f8b60d2718",
|
|
14
|
+
"comment": "First commit for overlay."
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Change Log - @ms-cloudpack/overlay
|
|
2
|
+
|
|
3
|
+
This log was last generated on Tue, 02 Aug 2022 19:53:43 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 0.0.2
|
|
8
|
+
|
|
9
|
+
Tue, 02 Aug 2022 19:53:43 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- First commit for overlay. (dzearing@microsoft.com)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function StatusBadge(): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { useDraggable } from '../../hooks/useDraggable';
|
|
3
|
+
import styles from './StatusBadge.module.css';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { getStatusText } from './getStatusText';
|
|
6
|
+
import { useStatus } from '../StatusProvider/useStatus';
|
|
7
|
+
export function StatusBadge() {
|
|
8
|
+
const rootElementRef = useRef(null);
|
|
9
|
+
const { status, pendingJobCount, completeJobCount, totalErrorCount, totalWarningCount } = useStatus();
|
|
10
|
+
useDraggable(rootElementRef);
|
|
11
|
+
const statusString = [
|
|
12
|
+
pendingJobCount ? `${pendingJobCount} pending` : undefined,
|
|
13
|
+
completeJobCount ? `${completeJobCount} complete` : undefined,
|
|
14
|
+
totalErrorCount ? `${totalErrorCount} errors` : undefined,
|
|
15
|
+
totalWarningCount ? `${totalWarningCount} warnings` : undefined,
|
|
16
|
+
]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(', ');
|
|
19
|
+
return (React.createElement("div", { className: styles.fixedOverlay },
|
|
20
|
+
React.createElement("div", { className: styles.contentSurface },
|
|
21
|
+
React.createElement("div", { ref: rootElementRef, className: cx(styles.badge, {
|
|
22
|
+
[styles.building]: status === 'building',
|
|
23
|
+
[styles.success]: status === 'success',
|
|
24
|
+
[styles.error]: status === 'error',
|
|
25
|
+
[styles.warning]: status === 'warning',
|
|
26
|
+
}) },
|
|
27
|
+
React.createElement("button", { className: styles.button },
|
|
28
|
+
React.createElement("div", { className: styles.value }, getStatusText(status))),
|
|
29
|
+
React.createElement("div", null, statusString.length ? `(${statusString})` : ''),
|
|
30
|
+
React.createElement("button", { className: styles.button }, "...")))));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=StatusBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","sourceRoot":"","sources":["../../../src/components/StatusBadge/StatusBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,MAAM,UAAU,WAAW;IACzB,MAAM,cAAc,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,eA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C;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type CloudpackStatus = 'unknown' | 'idle' | 'building' | 'success' | 'warning' | 'error' | 'cancelled';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBadge.types.js","sourceRoot":"","sources":["../../../src/components/StatusBadge/StatusBadge.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function getStatusText(status) {
|
|
2
|
+
switch (status) {
|
|
3
|
+
case 'idle':
|
|
4
|
+
return 'Idle';
|
|
5
|
+
case 'building':
|
|
6
|
+
return 'Building';
|
|
7
|
+
case 'success':
|
|
8
|
+
return 'Success';
|
|
9
|
+
case 'warning':
|
|
10
|
+
return 'Warning';
|
|
11
|
+
case 'error':
|
|
12
|
+
return 'Error';
|
|
13
|
+
case 'cancelled':
|
|
14
|
+
return 'Cancelled';
|
|
15
|
+
default:
|
|
16
|
+
return 'Unknown';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=getStatusText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStatusText.js","sourceRoot":"","sources":["../../../src/components/StatusBadge/getStatusText.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,MAAuB;IACnD,QAAQ,MAAM,EAAE;QACd,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QAErB;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CloudpackStatus {
|
|
3
|
+
status: 'building' | 'success' | 'error' | 'warning' | 'unknown';
|
|
4
|
+
pendingJobCount: number;
|
|
5
|
+
completeJobCount: number;
|
|
6
|
+
totalErrorCount: number;
|
|
7
|
+
totalWarningCount: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const StatusContext: React.Context<CloudpackStatus>;
|
|
10
|
+
export declare function StatusProvider({ children }: {
|
|
11
|
+
children: any;
|
|
12
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getCookies } from './getCookies.js';
|
|
3
|
+
const defaultStatus = {
|
|
4
|
+
status: 'unknown',
|
|
5
|
+
pendingJobCount: 0,
|
|
6
|
+
completeJobCount: 0,
|
|
7
|
+
totalErrorCount: 0,
|
|
8
|
+
totalWarningCount: 0,
|
|
9
|
+
};
|
|
10
|
+
export const StatusContext = React.createContext(defaultStatus);
|
|
11
|
+
export function StatusProvider({ children }) {
|
|
12
|
+
const [status, setStatus] = React.useState(defaultStatus);
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
const cookies = getCookies();
|
|
15
|
+
const sessionId = cookies['cloudpack-session-id'];
|
|
16
|
+
const apiUrl = cookies['cloudpack-api-url'];
|
|
17
|
+
console.log(`StatusProvider: sessionId=${sessionId}, apiurl=${apiUrl}`);
|
|
18
|
+
if (sessionId && apiUrl) {
|
|
19
|
+
console.log('setting up socket');
|
|
20
|
+
const socket = new WebSocket(apiUrl);
|
|
21
|
+
socket.onopen = () => {
|
|
22
|
+
console.log('socket opened');
|
|
23
|
+
// Send a subscribe request for the session status.
|
|
24
|
+
socket.send(JSON.stringify({
|
|
25
|
+
type: 'subscribe',
|
|
26
|
+
data: {
|
|
27
|
+
path: [sessionId, 'status'],
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
socket.onmessage = (result) => {
|
|
32
|
+
const response = JSON.parse(result.data);
|
|
33
|
+
switch (response.type) {
|
|
34
|
+
case 'notify':
|
|
35
|
+
setStatus(response.data);
|
|
36
|
+
break;
|
|
37
|
+
case 'reload':
|
|
38
|
+
window.location.reload();
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
console.log('socket message', response);
|
|
42
|
+
};
|
|
43
|
+
return () => {
|
|
44
|
+
socket.close();
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}, []);
|
|
48
|
+
return React.createElement(StatusContext.Provider, { value: status }, children);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=StatusProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusProvider.js","sourceRoot":"","sources":["../../../src/components/StatusProvider/StatusProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAU7C,MAAM,aAAa,GAAoB;IACrC,MAAM,EAAE,SAAS;IACjB,eAAe,EAAE,CAAC;IAClB,gBAAgB,EAAE,CAAC;IACnB,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAkB,aAAa,CAAC,CAAC;AAEjF,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE;IACzC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAkB,aAAa,CAAC,CAAC;IAE3E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAE5C,OAAO,CAAC,GAAG,CAAC,6BAA6B,SAAS,YAAY,MAAM,EAAE,CAAC,CAAC;QACxE,IAAI,SAAS,IAAI,MAAM,EAAE;YACvB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAEjC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;YAErC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;gBACnB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;gBAE7B,mDAAmD;gBACnD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,SAAS,CAAC;oBACb,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE;wBACJ,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;qBAC5B;iBACF,CAAC,CACH,CAAC;YACJ,CAAC,CAAC;YAEF,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,EAAE;gBAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAEzC,QAAQ,QAAQ,CAAC,IAAI,EAAE;oBACrB,KAAK,QAAQ;wBACX,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;wBACzB,MAAM;oBACR,KAAK,QAAQ;wBACX,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;wBACzB,MAAM;iBACT;gBAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;YAC1C,CAAC,CAAC;YAEF,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC,CAAC;SACH;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,IAAG,QAAQ,CAA0B,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCookies(): Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCookies.js","sourceRoot":"","sources":["../../../src/components/StatusProvider/getCookies.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ,CAAC,MAAM;SACnB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACf,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,OAAO,CAAC,CAAC;IACX,CAAC,EAAE,EAAE,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStatus: () => import("./StatusProvider").CloudpackStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStatus.js","sourceRoot":"","sources":["../../../src/components/StatusProvider/useStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export function useDraggable(hostElement, dragTargetElement = hostElement) {
|
|
3
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const moveTarget = hostElement.current;
|
|
6
|
+
const dragTarget = hostElement.current || dragTargetElement.current;
|
|
7
|
+
if (moveTarget && dragTarget) {
|
|
8
|
+
let originalX = 0;
|
|
9
|
+
let originalY = 0;
|
|
10
|
+
let offset = { x: 0, y: 0 };
|
|
11
|
+
const onPointerMove = (event) => {
|
|
12
|
+
moveTarget.style.transform = `translate(${offset.x + event.clientX - originalX}px, ${offset.y + event.clientY - originalY}px)`;
|
|
13
|
+
};
|
|
14
|
+
const onPointerUp = (event) => {
|
|
15
|
+
setIsDragging(false);
|
|
16
|
+
offset = {
|
|
17
|
+
x: offset.x + event.clientX - originalX,
|
|
18
|
+
y: offset.y + event.clientY - originalY,
|
|
19
|
+
};
|
|
20
|
+
dragTarget.releasePointerCapture(event.pointerId);
|
|
21
|
+
dragTarget.removeEventListener('pointerup', onPointerUp);
|
|
22
|
+
dragTarget.removeEventListener('pointermove', onPointerMove);
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
};
|
|
25
|
+
const onPointerDown = (event) => {
|
|
26
|
+
setIsDragging(true);
|
|
27
|
+
originalX = event.clientX;
|
|
28
|
+
originalY = event.clientY;
|
|
29
|
+
dragTarget.setPointerCapture(event.pointerId);
|
|
30
|
+
dragTarget.addEventListener('pointerup', onPointerUp);
|
|
31
|
+
dragTarget.addEventListener('pointermove', onPointerMove);
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
};
|
|
34
|
+
dragTarget.addEventListener('pointerdown', onPointerDown);
|
|
35
|
+
return () => {
|
|
36
|
+
dragTarget.removeEventListener('pointerdown', onPointerDown);
|
|
37
|
+
dragTarget.removeEventListener('pointermove', onPointerMove);
|
|
38
|
+
dragTarget.removeEventListener('pointerup', onPointerUp);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [hostElement, dragTargetElement]);
|
|
42
|
+
return {
|
|
43
|
+
isDragging,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=useDraggable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDraggable.js","sourceRoot":"","sources":["../../src/hooks/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,UAAU,YAAY,CAAC,WAAmC,EAAE,iBAAiB,GAAG,WAAW;IAC/F,MAAM,CAAC,U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CAAC,IAAI,CAAC,CAAC;gBACpB,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC1B,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC1B,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBAC9C,UAAU,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;gBACtD,UAAU,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;gBAC1D,KAAK,CAAC,cAAc,EAAE,CAAC;YACzB,CAAC,CAAC;YAEF,UAAU,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;YAE1D,OAAO,GAAG,EAAE;gBACV,UAAU,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;gBAC7D,UAAU,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;gBAC7D,UAAU,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC3D,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAErC,OAAO;QACL,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSessionId: () => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const getSessionId = () => {
|
|
3
|
+
const cookies = document.cookie?.split(';').reduce((p, n) => {
|
|
4
|
+
const [id, value] = n.split('=');
|
|
5
|
+
p[id.trim()] = value;
|
|
6
|
+
return p;
|
|
7
|
+
}, {});
|
|
8
|
+
return cookies?.['cloudpack-session-id'];
|
|
9
|
+
};
|
|
10
|
+
export const useSessionId = () => {
|
|
11
|
+
const [sessionId] = React.useState(getSessionId());
|
|
12
|
+
return sessionId;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useSessionId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSessionId.js","sourceRoot":"","sources":["../../src/hooks/useSessionId.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAyB,EAAE,CAAC,EAAE,EAAE;QAClF,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,EAAE,CAAC,sBAAsB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IAEnD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { StatusBadge } from './components/StatusBadge/StatusBadge';
|
|
4
|
+
import { StatusProvider } from './components/StatusProvider/StatusProvider';
|
|
5
|
+
const rootDiv = document.createElement('div');
|
|
6
|
+
ReactDOM.render(React.createElement(StatusProvider, null,
|
|
7
|
+
React.createElement(StatusBadge, null)), rootDiv);
|
|
8
|
+
document.body.appendChild(rootDiv);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAE9C,QAAQ,CAAC,MAAM,CACb,oBAAC,cAAc;IACb,oBAAC,WAAW,OAAG,CACA,EACjB,OAAO,CACR,CAAC;AAEF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.28.7"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ms-cloudpack/overlay",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "The Cloudpack overlay ux.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"types": "./lib/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/index.d.ts",
|
|
10
|
+
"import": "./lib/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"api:update": "cloudpack-scripts api-update",
|
|
15
|
+
"api": "cloudpack-scripts api",
|
|
16
|
+
"build:watch": "cloudpack-scripts build-watch",
|
|
17
|
+
"build": "cloudpack-scripts build",
|
|
18
|
+
"lint:update": "cloudpack-scripts lint-update",
|
|
19
|
+
"lint": "cloudpack-scripts lint"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"react": "^17.0.2",
|
|
23
|
+
"react-dom": "^17.0.2"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@ms-cloudpack/eslint-config-base": "*",
|
|
27
|
+
"@ms-cloudpack/scripts": "*",
|
|
28
|
+
"@types/react-dom": "17.0.17",
|
|
29
|
+
"@types/react": "17.0.48"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"/lib"
|
|
33
|
+
]
|
|
34
|
+
}
|