@verifiedinc-public/shared-ui-elements 9.8.1 → 9.8.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.
@@ -1 +1 @@
1
- "use strict";import{Box as l,Stack as s,Typography as t,Paper as c}from"@mui/material";import{jsx as r,jsxs as o,Fragment as u}from"react/jsx-runtime";function e({label:a,value:n,color:i}){return n?o(l,{sx:{mb:.75},children:[o(t,{variant:"body2",component:"span",color:"text.secondary",children:[a,":"," "]}),r(t,{variant:"body2",component:"span",fontWeight:600,fontFamily:"monospace",color:i??"text.primary",children:n})]}):null}function d({log:a}){return r(l,{sx:{p:2},children:o(s,{direction:"row",spacing:4,children:[o(l,{sx:{width:480,flexShrink:0},children:[r(t,{variant:"subtitle2",fontWeight:700,color:"text.primary",sx:{mb:1},children:"DETAILS"}),r(e,{label:"1-Click UUID",value:a.uuid}),a.sessionUuid&&r(e,{label:"Session UUID",value:a.sessionUuid}),r(e,{label:"Source",value:a.source}),r(e,{label:"Event Type",value:a.errorCode?"response_error":"request"}),r(e,{label:"Method",value:a.source==="api"?`${a.method} /${a.path}`:a.path}),a.source==="api"&&o(u,{children:[r(e,{label:"HTTP Status",value:String(a.statusCode)}),r(e,{label:"Latency",value:a.latencyMs?`${a.latencyMs}ms`:null})]}),r(e,{label:"Phone",value:a.phone}),r(e,{label:"Error Code",value:a.errorCode,color:"error.main"}),r(e,{label:"Error",value:a.errorMessage,color:"error.main"})]}),o(l,{sx:{flex:1},children:[r(t,{variant:"subtitle2",fontWeight:700,color:"text.primary",sx:{mb:1},children:"METADATA"}),r(c,{variant:"outlined",sx:{p:2,bgcolor:"grey.100",fontFamily:"monospace",fontSize:13,whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflow:"auto"},children:a.metadata?JSON.stringify(a.metadata,null,2):"No metadata available"})]})]})})}export{d as LogDetailPanel};
1
+ "use strict";import{Box as l,Stack as s,Typography as t,Paper as c}from"@mui/material";import{PRODUCT_LABELS as u}from"../constants.mjs";import{jsx as r,jsxs as o,Fragment as d}from"react/jsx-runtime";function e({label:a,value:n,color:i}){return n?o(l,{sx:{mb:.75},children:[o(t,{variant:"body2",component:"span",color:"text.secondary",children:[a,":"," "]}),r(t,{variant:"body2",component:"span",fontWeight:600,fontFamily:"monospace",color:i??"text.primary",children:n})]}):null}function p({log:a}){return r(l,{sx:{p:2},children:o(s,{direction:"row",spacing:4,children:[o(l,{sx:{width:480,flexShrink:0},children:[r(t,{variant:"subtitle2",fontWeight:700,color:"text.primary",sx:{mb:1},children:"DETAILS"}),r(e,{label:"1-Click UUID",value:a.uuid}),a.sessionUuid&&r(e,{label:"Session UUID",value:a.sessionUuid}),r(e,{label:"Source",value:a.source}),r(e,{label:"Product",value:u[a.product]}),r(e,{label:"Event Type",value:a.errorCode?"response_error":"request"}),r(e,{label:"Method",value:a.source==="api"?`${a.method} /${a.path}`:a.path}),a.source==="api"&&o(d,{children:[r(e,{label:"HTTP Status",value:String(a.statusCode)}),r(e,{label:"Latency",value:a.latencyMs?`${a.latencyMs}ms`:null})]}),r(e,{label:"Phone",value:a.phone}),r(e,{label:"Error Code",value:a.errorCode,color:"error.main"}),r(e,{label:"Error",value:a.errorMessage,color:"error.main"})]}),o(l,{sx:{flex:1},children:[r(t,{variant:"subtitle2",fontWeight:700,color:"text.primary",sx:{mb:1},children:"METADATA"}),r(c,{variant:"outlined",sx:{p:2,bgcolor:"grey.100",fontFamily:"monospace",fontSize:13,whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflow:"auto"},children:a.metadata?JSON.stringify(a.metadata,null,2):"No metadata available"})]})]})})}export{p as LogDetailPanel};
@@ -1 +1 @@
1
- "use strict";import M,{useMemo as I,useState as E,useRef as $,useEffect as N}from"react";import{useVirtualizer as R}from"@tanstack/react-virtual";import{useTheme as K,useMediaQuery as V,Stack as m,TableContainer as q,Paper as G,Table as Q,TableHead as Z,TableRow as u,TableCell as o,Typography as i,TableBody as J,CircularProgress as W,Chip as X,Box as Y,IconButton as _,Tooltip as ee}from"@mui/material";import{ContentCopy as re}from"@mui/icons-material";import{EmptyChartSection as te}from"../../chart/EmptyChartSection.mjs";import{useCopyToClipboard as ne}from"../../../hooks/useCopyToClipboard.mjs";import{useSnackbar as oe}from"../../Snackbar/index.mjs";import{formatLogTimestamp as ie}from"../../../utils/date.mjs";import{LogDetailPanel as ae}from"./LogDetailPanel.mjs";import{useBidirectionalScroll as le}from"../../../hooks/useBidirectionalScroll.mjs";import{jsx as e,jsxs as s}from"react/jsx-runtime";function se({statusCode:t,errorCode:a}){let l="grey.400";return a??t>=400?l="error.main":t>=200&&t<300&&(l="success.main"),e(Y,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:l,flexShrink:0}})}function A({value:t,label:a,onCopy:l}){return e(_,{className:"copy-btn",size:"small",onClick:x=>{x.stopPropagation(),l(a,t)},sx:{p:.25,ml:.5},children:e(re,{sx:{fontSize:13}})})}function ce(t){return t?t.length<=12?t:`${t.slice(0,4)}\u2026${t.slice(-4)}`:"\u2014"}function de(t){return t.source==="sdk"?t.path:`${t.method} /${t.path}`}function he({text:t}){const a=$(null),[l,x]=E(!1);return N(()=>{const p=a.current;p&&x(p.scrollWidth>p.clientWidth)},[t]),e(ee,{title:l?t:"",placement:"top",children:e(i,{ref:a,variant:"body2",noWrap:!0,sx:{fontSize:"0.8em",color:"text.primary",fontFamily:"monospace"},children:t})})}const pe=48,me={fontFamily:"monospace"};function ue({data:t,isLoading:a,hasOlder:l,hasNewer:x,isLoadingOlder:p,isLoadingNewer:C,onLoadNewer:B,onLoadOlder:O,filterKey:P,timeZone:j}){const F=K(),v=V(F.breakpoints.down("xl")),d={...me,fontSize:"0.8em"},H=I(()=>[{label:"Timestamp",width:230},{label:"Phone",width:150},{label:"1-Click UUID",width:130},{label:"Source",width:90},{label:"Event",width:v?125:200},{label:"HTTP",align:"right",width:75},{label:"Latency",align:"right",width:100},{label:"Error",width:140}],[v]),[g,w]=E(null),b=$(null),{copy:U}=ne({type:"text/plain"}),{enqueueSnackbar:D}=oe(),T=async(n,r)=>{await U(r),D(`${n} copied to clipboard`,"success")},h=I(()=>t?.data??[],[t?.data]),y=R({count:h.length,getScrollElement:()=>b.current,estimateSize:()=>pe,overscan:5});le({scrollContainerRef:b,virtualizer:y,rowCount:h.length,hasNewer:x,hasOlder:l,isLoadingNewer:C,isLoadingOlder:p,onLoadNewer:B,onLoadOlder:O,resetKey:P});const c=y.getVirtualItems(),k=(n,r)=>`${n.eventTimestamp}-${r}`;N(()=>{g&&(c.some(n=>{const r=h[n.index];return k(r,n.index)===g})||w(null))},[c,g,h]);const S=c.length>0?c[0].start:0,L=c.length>0?y.getTotalSize()-c[c.length-1].end:0;return!a&&h.length===0?e(te,{}):e(m,{sx:{width:"100%",flex:1,minHeight:0},children:e(q,{component:G,ref:b,sx:{flex:1,scrollbarGutter:"stable",minHeight:500},children:s(Q,{size:"small",stickyHeader:!0,sx:{minWidth:1230,tableLayout:"fixed"},children:[e(Z,{children:s(u,{children:[e(o,{sx:{width:32,bgcolor:"background.paper"}}),H.map(n=>e(o,{sx:{textAlign:n.align,width:n.width},children:e(i,{sx:{textTransform:"uppercase"},variant:"subtitle2",children:n.label})},n.label))]})}),s(J,{children:[a&&h.length===0&&e(u,{children:e(o,{colSpan:9,sx:{textAlign:"center",py:2},children:e(i,{color:"text.secondary",children:"Loading..."})})}),C&&e(u,{sx:{position:"sticky",top:37,zIndex:1,pointerEvents:"none"},children:e(o,{colSpan:9,sx:{textAlign:"center",py:.75,bgcolor:"grey.100",borderBottom:"1px solid",borderColor:"divider"},children:s(m,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1,children:[e(W,{size:12}),e(i,{variant:"caption",color:"text.secondary",children:"Loading newer logs"})]})})}),S>0&&e("tr",{children:e("td",{style:{height:S,padding:0,border:"none"}})}),c.map(n=>{const r=h[n.index],z=k(r,n.index),f=g===z;return s(M.Fragment,{children:[s(u,{"data-index":n.index,ref:y.measureElement,onClick:()=>w(f?null:z),hover:!0,sx:{cursor:"pointer","& > td":{borderBottom:f?"none":void 0}},children:[e(o,{sx:{width:32,px:1},children:e(m,{alignItems:"center",justifyContent:"center",height:"100%",children:e(se,{statusCode:r.statusCode,errorCode:r.errorCode})})}),e(o,{sx:{whiteSpace:"nowrap"},children:e(i,{variant:"body2",color:"text.secondary",sx:d,children:ie(r.eventTimestamp,j)})}),e(o,{sx:{"& .copy-btn":{opacity:0},"&:hover .copy-btn":{opacity:1}},children:s(m,{direction:"row",alignItems:"center",children:[e(i,{variant:"body2",color:"text.secondary",sx:d,children:r.phone??"\u2014"}),r.phone&&e(A,{value:r.phone,label:"Phone",onCopy:T})]})}),e(o,{sx:{"& .copy-btn":{opacity:0},"&:hover .copy-btn":{opacity:1}},children:s(m,{direction:"row",alignItems:"center",overflow:"hidden",children:[e(i,{variant:"body2",color:"text.secondary",noWrap:!0,sx:d,children:ce(r.uuid)}),r.uuid&&e(A,{value:r.uuid,label:"1-Click UUID",onCopy:T})]})}),e(o,{children:e(X,{label:r.source.toUpperCase(),size:"small",variant:"filled",sx:{fontWeight:600,fontSize:12,minWidth:40,bgcolor:r.source==="sdk"?"#4FC3F7":"primary.main",color:"white"}})}),e(o,{children:e(he,{text:de(r)})}),e(o,{sx:{textAlign:"right"},children:e(i,{variant:"body2",sx:{...d,color:r.source==="sdk"?"text.secondary":r.statusCode>=400?"error.main":"success.main"},children:r.source==="sdk"?"\u2014":r.statusCode})}),e(o,{sx:{textAlign:"right"},children:e(i,{variant:"body2",color:"text.secondary",sx:d,children:r.source==="sdk"||!r.latencyMs?"\u2014":`${r.latencyMs}ms`})}),e(o,{children:r.errorCode?e(i,{variant:"body2",sx:{...d,color:"error.main"},children:r.errorCode}):e(i,{variant:"body2",color:"text.secondary",sx:d,children:"\u2014"})})]}),f&&e(u,{children:e(o,{colSpan:9,sx:{py:0,px:1,borderTop:"none",bgcolor:"grey.50"},children:e(ae,{log:r})})})]},n.key)}),L>0&&e("tr",{children:e("td",{style:{height:L,padding:0,border:"none"}})}),p&&e(u,{sx:{position:"sticky",bottom:0,zIndex:1,pointerEvents:"none"},children:e(o,{colSpan:9,sx:{textAlign:"center",py:.75,bgcolor:"grey.100",borderTop:"1px solid",borderColor:"divider"},children:s(m,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1,children:[e(W,{size:12}),e(i,{variant:"caption",color:"text.secondary",children:"Loading older logs"})]})})})]})]})})})}export{ue as LogsTable};
1
+ "use strict";import q,{useMemo as O,useState as v,useRef as S,useEffect as T}from"react";import{useVirtualizer as K}from"@tanstack/react-virtual";import{useTheme as V,useMediaQuery as G,Stack as m,TableContainer as Q,Paper as Z,Table as _,TableHead as J,TableRow as x,TableCell as t,Typography as a,TableBody as X,CircularProgress as $,Chip as A,Box as Y,IconButton as ee,Tooltip as B}from"@mui/material";import{ContentCopy as re}from"@mui/icons-material";import{EmptyChartSection as oe}from"../../chart/EmptyChartSection.mjs";import{useCopyToClipboard as ne}from"../../../hooks/useCopyToClipboard.mjs";import{useSnackbar as te}from"../../Snackbar/index.mjs";import{formatLogTimestamp as ie}from"../../../utils/date.mjs";import{PRODUCT_LABELS as le}from"../constants.mjs";import{LogDetailPanel as ae}from"./LogDetailPanel.mjs";import{useBidirectionalScroll as se}from"../../../hooks/useBidirectionalScroll.mjs";import{jsx as e,jsxs as s}from"react/jsx-runtime";function de({statusCode:o,errorCode:i}){let l="grey.400";return i??o>=400?l="error.main":o>=200&&o<300&&(l="success.main"),e(Y,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:l,flexShrink:0}})}function N({value:o,label:i,onCopy:l}){return e(ee,{className:"copy-btn",size:"small",onClick:h=>{h.stopPropagation(),l(i,o)},sx:{p:.25,ml:.5},children:e(re,{sx:{fontSize:13}})})}function ce(o){return o?o.length<=12?o:`${o.slice(0,4)}\u2026${o.slice(-4)}`:"\u2014"}function he(o){return o.source==="sdk"?o.path:`${o.method} /${o.path}`}function pe({text:o}){const i=S(null),[l,h]=v(!1);return T(()=>{const d=i.current;d&&h(d.scrollWidth>d.clientWidth)},[o]),e(B,{title:l?o:"",placement:"top",children:e(a,{ref:i,variant:"body2",noWrap:!0,sx:{fontSize:"0.8em",color:"text.primary",fontFamily:"monospace"},children:o})})}function ue({label:o,...i}){const l=S(null),[h,d]=v(!1);return T(()=>{var g;const y=(g=l.current)==null?void 0:g.querySelector(".MuiChip-label");y&&d(y.scrollWidth>y.clientWidth)},[o]),e(B,{title:h?o:"",placement:"top",children:e(A,{ref:l,label:o,...i,sx:{...i.sx,maxWidth:"100%","& .MuiChip-label":{overflow:"hidden",textOverflow:"ellipsis"}}})})}const me=48,xe={fontFamily:"monospace"};function ge({data:o,isLoading:i,hasOlder:l,hasNewer:h,isLoadingOlder:d,isLoadingNewer:g,onLoadNewer:y,onLoadOlder:M,filterKey:j,timeZone:F}){const U=V(),k=G(U.breakpoints.down("xl")),p={...xe,fontSize:"0.8em"},D=O(()=>[{label:"Timestamp",width:230},{label:"Phone",width:150},{label:"1-Click UUID",width:130},{label:"Source",width:90},{label:"Product",width:140},{label:"Event",width:k?125:200},{label:"HTTP",align:"right",width:75},{label:"Latency",align:"right",width:100},{label:"Error",width:140}],[k]),[b,L]=v(null),C=S(null),{copy:H}=ne({type:"text/plain"}),{enqueueSnackbar:R}=te(),z=async(n,r)=>{await H(r),R(`${n} copied to clipboard`,"success")},u=O(()=>o?.data??[],[o?.data]),f=K({count:u.length,getScrollElement:()=>C.current,estimateSize:()=>me,overscan:5});se({scrollContainerRef:C,virtualizer:f,rowCount:u.length,hasNewer:h,hasOlder:l,isLoadingNewer:g,isLoadingOlder:d,onLoadNewer:y,onLoadOlder:M,resetKey:j});const c=f.getVirtualItems(),I=(n,r)=>`${n.eventTimestamp}-${r}`;T(()=>{b&&(c.some(n=>{const r=u[n.index];return I(r,n.index)===b})||L(null))},[c,b,u]);const W=c.length>0?c[0].start:0,E=c.length>0?f.getTotalSize()-c[c.length-1].end:0;return!i&&u.length===0?e(oe,{}):e(m,{sx:{width:"100%",flex:1,minHeight:0},children:e(Q,{component:Z,ref:C,sx:{flex:1,scrollbarGutter:"stable",minHeight:500},children:s(_,{size:"small",stickyHeader:!0,sx:{minWidth:1230,tableLayout:"fixed"},children:[e(J,{children:s(x,{children:[e(t,{sx:{width:32,bgcolor:"background.paper"}}),D.map(n=>e(t,{sx:{textAlign:n.align,width:n.width},children:e(a,{sx:{textTransform:"uppercase"},variant:"subtitle2",children:n.label})},n.label))]})}),s(X,{children:[i&&u.length===0&&e(x,{children:e(t,{colSpan:10,sx:{textAlign:"center",py:2},children:e(a,{color:"text.secondary",children:"Loading..."})})}),g&&e(x,{sx:{position:"sticky",top:37,zIndex:1,pointerEvents:"none"},children:e(t,{colSpan:10,sx:{textAlign:"center",py:.75,bgcolor:"grey.100",borderBottom:"1px solid",borderColor:"divider"},children:s(m,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1,children:[e($,{size:12}),e(a,{variant:"caption",color:"text.secondary",children:"Loading newer logs"})]})})}),W>0&&e("tr",{children:e("td",{style:{height:W,padding:0,border:"none"}})}),c.map(n=>{const r=u[n.index],P=I(r,n.index),w=b===P;return s(q.Fragment,{children:[s(x,{"data-index":n.index,ref:f.measureElement,onClick:()=>L(w?null:P),hover:!0,sx:{cursor:"pointer","& > td":{borderBottom:w?"none":void 0}},children:[e(t,{sx:{width:32,px:1},children:e(m,{alignItems:"center",justifyContent:"center",height:"100%",children:e(de,{statusCode:r.statusCode,errorCode:r.errorCode})})}),e(t,{sx:{whiteSpace:"nowrap"},children:e(a,{variant:"body2",color:"text.secondary",sx:p,children:ie(r.eventTimestamp,F)})}),e(t,{sx:{"& .copy-btn":{opacity:0},"&:hover .copy-btn":{opacity:1}},children:s(m,{direction:"row",alignItems:"center",children:[e(a,{variant:"body2",color:"text.secondary",sx:p,children:r.phone??"\u2014"}),r.phone&&e(N,{value:r.phone,label:"Phone",onCopy:z})]})}),e(t,{sx:{"& .copy-btn":{opacity:0},"&:hover .copy-btn":{opacity:1}},children:s(m,{direction:"row",alignItems:"center",overflow:"hidden",children:[e(a,{variant:"body2",color:"text.secondary",noWrap:!0,sx:p,children:ce(r.uuid)}),r.uuid&&e(N,{value:r.uuid,label:"1-Click UUID",onCopy:z})]})}),e(t,{children:e(A,{label:r.source.toUpperCase(),size:"small",variant:"filled",sx:{fontWeight:600,fontSize:12,minWidth:40,bgcolor:r.source==="sdk"?"#4FC3F7":"primary.main",color:"white"}})}),e(t,{children:e(ue,{label:le[r.product],variant:"outlined",sx:{fontSize:13,fontWeight:600,minWidth:110}})}),e(t,{children:e(pe,{text:he(r)})}),e(t,{sx:{textAlign:"right"},children:e(a,{variant:"body2",sx:{...p,color:r.source==="sdk"?"text.secondary":r.statusCode>=400?"error.main":"success.main"},children:r.source==="sdk"?"\u2014":r.statusCode})}),e(t,{sx:{textAlign:"right"},children:e(a,{variant:"body2",color:"text.secondary",sx:p,children:r.source==="sdk"||!r.latencyMs?"\u2014":`${r.latencyMs}ms`})}),e(t,{children:r.errorCode?e(a,{variant:"body2",sx:{...p,color:"error.main"},children:r.errorCode}):e(a,{variant:"body2",color:"text.secondary",sx:p,children:"\u2014"})})]}),w&&e(x,{children:e(t,{colSpan:10,sx:{py:0,px:1,borderTop:"none",bgcolor:"grey.50"},children:e(ae,{log:r})})})]},n.key)}),E>0&&e("tr",{children:e("td",{style:{height:E,padding:0,border:"none"}})}),d&&e(x,{sx:{position:"sticky",bottom:0,zIndex:1,pointerEvents:"none"},children:e(t,{colSpan:10,sx:{textAlign:"center",py:.75,bgcolor:"grey.100",borderTop:"1px solid",borderColor:"divider"},children:s(m,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1,children:[e($,{size:12}),e(a,{variant:"caption",color:"text.secondary",children:"Loading older logs"})]})})})]})]})})})}export{ge as LogsTable};
@@ -0,0 +1,2 @@
1
+ import { LogEntry } from './types';
2
+ export declare const PRODUCT_LABELS: Record<LogEntry['product'], string>;
@@ -0,0 +1 @@
1
+ "use strict";const i={signup:"1-Click Signup",verify:"1-Click Verify",health:"1-Click Health","text-to-signup":"Text to Signup"};export{i as PRODUCT_LABELS};
@@ -2,7 +2,7 @@ export interface LogEntry {
2
2
  brandUuid: string;
3
3
  phone: string | null;
4
4
  uuid: string | null;
5
- product: 'signup' | 'verify';
5
+ product: 'signup' | 'verify' | 'health' | 'text-to-signup';
6
6
  sessionUuid: string | null;
7
7
  method: string;
8
8
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "9.8.1",
3
+ "version": "9.8.2",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,