@viswa-test/creative-workspace-ui-component 0.0.71 → 0.0.72
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/cjs/components/AssignReminders/AssignReminderLevels.js +1 -1
- package/dist/cjs/components/AssignReminders/AssignReminderWrapper.js +1 -1
- package/dist/cjs/components/AssignReminders/ManageReminders.js +1 -1
- package/dist/cjs/components/AssignReminders/components/AssignLevelsDatePicker.js +1 -1
- package/dist/cjs/components/AssignReminders/components/CustomDatePicker.js +1 -1
- package/dist/cjs/components/AssignReminders/components/ReviewStatus.js +1 -1
- package/dist/cjs/components/AssignReminders/utils/approvalDateValidation.js +2 -0
- package/dist/cjs/components/AssignReminders/utils/approvalDateValidation.js.map +1 -0
- package/dist/components/AssignReminders/AssignReminderLevels.js +1 -1
- package/dist/components/AssignReminders/AssignReminderWrapper.js +1 -1
- package/dist/components/AssignReminders/ManageReminders.js +1 -1
- package/dist/components/AssignReminders/components/AssignLevelsDatePicker.js +1 -1
- package/dist/components/AssignReminders/components/CustomDatePicker.js +1 -1
- package/dist/components/AssignReminders/components/ReviewStatus.js +1 -1
- package/dist/components/AssignReminders/utils/approvalDateValidation.js +2 -0
- package/dist/components/AssignReminders/utils/approvalDateValidation.js.map +1 -0
- package/dist/types/components/AssignReminders/AssignReminderLevels.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/AssignReminderWrapper.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/ManageReminders.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/components/AssignLevelsDatePicker.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/components/CustomDatePicker.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/components/ReviewStatus.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/utils/approvalDateValidation.d.ts +7 -0
- package/dist/types/components/AssignReminders/utils/approvalDateValidation.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("lucide-react"),a=require("./AssignLevelAccordions.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("lucide-react"),a=require("./AssignLevelAccordions.js"),t=require("./components/CustomCheckbox.js"),l=require("./assets/FileCheckCorner.js"),r=require("./styles/AssignReminderStyles.js"),o=require("./utils/approvalDateValidation.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(i),c=[{label:"Edit & Approve",icon:n.jsx(l.default,{})},{label:"Edit",icon:n.jsx(s.PenLine,{size:14})},{label:"Approve",icon:n.jsx(s.UserRoundCheck,{size:14})},{label:"Notify",icon:n.jsx(s.Bell,{size:14})}],p=function(){return o.startOfCalendarDay(new Date)},_=function(e,n){var i=o.getLatestLevelDueDate(e.slice(0,n));return i&&i>p()?i:p()},f=function(e,n,i){var s=o.getEarliestLevelDueDate(e.slice(n+1)),a=i?o.startOfCalendarDay(i):null;return s?a?s<a?s:a:s:a};exports.AssignReminderLevels=function(i){var l=i.title,u=i.levels,p=void 0===u?[]:u,g=i.requireFinalApproval,v=void 0!==g&&g,x=i.additionalInfo,h=i.setLevels,y=i.setRequireFinalApproval,j=i.fetchUsers,A=i.accessLevelOptions,D=void 0===A?c:A,m=i.customInfoIcon,L=i.onValidationError,E=i.customStyles,S=void 0===E?{}:E,b=i.totalLevels,I=i.finalApprovalDueDate,F=i.displayConfig,C=d.default.useState(!1),R=C[0],M=C[1],T=!!(null==F?void 0:F.disableRequiredButtonOnUserAdd),w=function(e){return(null!=e?e:[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)||!!(null==e?void 0:e.name)})};d.default.useEffect(function(){T&&(null==h||h(function(n){var i=!1,s=n.map(function(n){var s,a,t=(null!==(a=null===(s=n.assignees)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0;return n.isHidden||n.isMandatory||!t?n:(i=!0,e.__assign(e.__assign({},n),{isMandatory:!0}))});return i?s:n}))},[p,h,T]);var q,N=d.default.useMemo(function(){return Array.from({length:null!=b?b:3},function(e,n){var i;return null!==(i=p[n])&&void 0!==i?i:{title:"Level ".concat(n+1),headerName:"L ".concat(n+1),isMandatory:!1,dueDate:null,assignees:[],hasDueDate:!0}})},[p,b]),z=(p.length>0?p:N).filter(function(e){return!e.isHidden});return n.jsxs("div",e.__assign({style:e.__assign({padding:"8px",display:"flex",flexDirection:"column",gap:"18px"},S.container)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.header),S.levelsHeader)},{children:[n.jsx("span",{children:null!=l?l:"Assignee Levels"}),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.infoIconWrapper),S.infoIconWrapper),onMouseEnter:function(){return M(!0)},onMouseLeave:function(){return M(!1)}},{children:[null!=m?m:n.jsx(s.InfoIcon,{width:18,height:18}),n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.tooltip),S.tooltip),R?e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.tooltipVisible),S.tooltipVisible):{})},{children:x||n.jsxs("span",{children:[n.jsx("b",{children:"How it works:"}),n.jsx("br",{}),"Level 1 is required by default, Enable Level 2 and Level 3 to add sequential approval steps for the review"]})}))]}))]})),n.jsx("div",e.__assign({style:e.__assign({display:"flex",flexDirection:"column",gap:"16px"},S.accordionsContainer)},{children:z.map(function(i,s){return n.jsx(a.default,{level:T&&w(i.assignees)?e.__assign(e.__assign({},i),{isMandatory:!0}):i,id:String(s),accessLevelOptions:D,fetchUsers:j,onToggleMandatory:function(){return function(n){var i,s,a,t=(null!==(a=null===(s=null===(i=p[n])||void 0===i?void 0:i.assignees)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0;T&&t||null==h||h(function(i){return i.map(function(i,s){return s===n?e.__assign(e.__assign({},i),{isMandatory:!i.isMandatory}):i})})}(s)},onDueDateChange:function(n){return function(n,i){if(i){var s=o.startOfCalendarDay(i),a=p.filter(function(e){return!e.isHidden}),t=_(a,n),l=f(a,n,I);if(s<t)return void(null==L||L(0===n?"Level 1 due date cannot be before today":"Level ".concat(n+1," due date cannot be before Level ").concat(n," due date")));if(l&&s>l){var r=a.slice(n+1).some(function(e){return!!e.dueDate});return void(null==L||L(r?"Level ".concat(n+1," due date cannot be after a later level due date"):"Level due date cannot be after final approval due date"))}}null==h||h(function(s){return s.map(function(a,t){return a.isHidden?a:s.slice(0,t).filter(function(e){return!e.isHidden}).length===n?e.__assign(e.__assign({},a),{dueDate:i?o.normalizeApprovalDate(i):null}):a})})}(s,n)},onAssigneesChange:function(n){return i=s,t=(null!=(a=n)?a:[]).map(function(n){var i=n.accessLevel||n.role||"";return e.__assign(e.__assign({},n),{role:i,accessLevel:i})}),l=T&&w(t),void(null==h||h(function(n){return n.map(function(n,s){return s===i?e.__assign(e.__assign({},n),{assignees:t,isMandatory:!!l||n.isMandatory}):n})}));var i,a,t,l},onTitleChange:function(n){return function(n,i){null==h||h(function(s){return s.map(function(s,a){return a===n?e.__assign(e.__assign({},s),{title:i}):s})})}(s,n)},minDueDate:_(z,s),maxDueDate:f(z,s,I),finalApprovalDueDate:I,displayConfig:F},s)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.finalApprovalBox),S.finalApprovalBox)},{children:[n.jsx(t.default,{getter:v,setter:null!=y?y:function(){}}),n.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:"column",alignItems:"baseline",fontSize:"14px",fontWeight:400},S.finalApprovalTextWrapper)},{children:[n.jsx("span",e.__assign({style:e.__assign({fontWeight:500},S.finalApprovalTitle)},{children:"Require Final Approval"})),n.jsx("span",e.__assign({style:S.finalApprovalDesc},{children:"After all assignees approve, you (the owner) will be notified to give final sign-off before the redline is settled."}))]}))]})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.currentApprovalFlow),S.currentApprovalFlow)},{children:[n.jsx("span",e.__assign({style:e.__assign({fontSize:"14px",fontWeight:600},S.currentApprovalFlowTitle)},{children:"Current Approval Flow"})),(q=p.filter(function(e){var n,i;return(null!==(i=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0}),n.jsx("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"4px"},S.approvalFlowItemsWrapper)},{children:q.map(function(i,a){var t,l,r=i.isHidden,o=!i.isMandatory&&!r,u=null!==(t=i.assignees)&&void 0!==t?t:[],c=r?n.jsx(s.User,{size:16}):function(e){switch(e){case 0:return n.jsx(s.Edit2,{size:16});case 1:return n.jsx(s.FileCheck,{size:16});case 2:return n.jsx(s.User,{size:16});default:return n.jsx(s.CheckSquare,{size:16})}}(a);return n.jsxs(d.default.Fragment,{children:[n.jsxs("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",fontWeight:500,color:o?"#64748B":"#374151",border:o?"1px dashed #CBD5E1":void 0,borderRadius:o?"6px":void 0,padding:o?"2px 6px":void 0},S.approvalFlowItem),title:i.title||"Level ".concat(a+1)},{children:[c,n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[u.map(function(i,s){var a,t,l=i.role||i.accessLevel||"No role assigned";return n.jsxs(d.default.Fragment,{children:[s>0&&n.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n.jsx("span",{children:i.name}),n.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:l}))]}))]},null!==(t=null!==(a=i.id)&&void 0!==a?a:i.email)&&void 0!==t?t:s)}),o&&n.jsx("span",{children:"(Optional)"})]}))]})),a<q.length-1&&n.jsx(s.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(l=i.id)&&void 0!==l?l:a)})})))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=AssignReminderLevels.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("lucide-react"),a=require("react"),s=require("./AssignReminderLevels.js"),t=require("./components/ReviewStatus.js"),r=require("./components/CustomDatePicker.js"),l=require("./ManageReminders.js"),o=require("./styles/AssignReminderWrapperStyles.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(a),_=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],c=[{tabName:"Assignees & Approvers",tabIcon:n.jsxs("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[n.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),n.jsx("circle",{cx:"9",cy:"7",r:"4"}),n.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),n.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:n.jsx(i.Bell,{size:15})},{tabName:"Review Status",tabIcon:n.jsx(i.ClipboardList,{size:15})}],v=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function f(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}var m=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e.__assign(e.__assign({},n),{isMandatory:!0,hasDueDate:!0})})},p=function(n){return n.map(function(n){var i;return e.__assign(e.__assign({},n),{assignees:(null!==(i=n.assignees)&&void 0!==i?i:[]).map(function(n){var i=n.accessLevel||n.role||"";return e.__assign(e.__assign({},n),{role:i,accessLevel:i})})})})},g=function(n,i){void 0===n&&(n=_),void 0===i&&(i=[]);var a=n.find(function(e){return e.isHidden}),s=i.find(function(e){return e.isHidden}),t=n.filter(function(e){return!e.isHidden}),r=a||s,l=r?e.__spreadArray(e.__spreadArray([],t,!0),[r],!1):t;return p(m(l))},R=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();return Number.isFinite(i)?n.toISOString():""},S=function(e){return void 0===e&&(e=[]),JSON.stringify(e.map(function(e){var n,i,a,s;return{headerName:null!==(n=e.headerName)&&void 0!==n?n:"",title:null!==(i=e.title)&&void 0!==i?i:"",isMandatory:!!e.isMandatory,hasDueDate:!!e.hasDueDate,isHidden:!!e.isHidden,dueDate:R(e.dueDate),status:null!==(a=e.status)&&void 0!==a?a:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(s=e.assignees)&&void 0!==s?s:[]).map(function(e){var n,i,a,s,t,r,l,o,d,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(a=e.email)&&void 0!==a?a:"",accessLevel:null!==(t=null!==(s=e.accessLevel)&&void 0!==s?s:e.role)&&void 0!==t?t:"",role:null!==(l=null!==(r=e.role)&&void 0!==r?r:e.accessLevel)&&void 0!==l?l:"",notes:null!==(o=e.notes)&&void 0!==o?o:"",sendMailNow:!!e.sendMailNow,action:null!==(d=e.action)&&void 0!==d?d:"",action_taken_at:null!==(u=e.action_taken_at)&&void 0!==u?u:""}})}}))},E=function(e){return R(e)},D=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return"username (you)"===n||"username"===n},A=function(e,n){return D(null==e?void 0:e.name)?D(null==n?void 0:n.name)?(null==e?void 0:e.email)||(null==n?void 0:n.email)||"Owner":n.name:e.name};exports.AssignReminderWrapper=function(d){var R,D,y=d.metadata,L=void 0===y?{}:y,h=d.reviewData,b=void 0===h?{}:h,T=d.levels,N=d.setLevels,x=d.requireFinalApproval,I=d.setRequireFinalApproval,P=d.approvalDueDate,w=d.setApprovalDueDate,M=d.onClose,j=d.fetchUsers,F=d.onSave,q=d.onValidationError,C=d.showApproveAndMoveToNextLevelButton,B=d.onApproveAndMoveToNextLevel,W=d.totalLevels,U=d.customStyles,G=void 0===U?{}:U,Y=d.isSaving,O=void 0!==Y&&Y,k=d.displayConfig,H=void 0===k?{}:k,z=d.onRequireFinalApproval,V=d.isOwner,J=void 0===V||V,X=d.blockEditScreen,K=void 0!==X&&X,Q=d.hideManageReminders,Z=void 0!==Q&&Q,$=d.hideClearButton,ee=void 0!==$&&$,ne=d.hideSaveChangesButton,ie=void 0!==ne&&ne,ae=d.hideFooterActions,se=void 0!==ae&&ae;d.hideAssigneeApproverScreen,d.remindersData;var te=d.remainderOwners,re=d.setRemainderOwners,le=d.schedules,oe=d.setSchedules,de=d.handelSendNow,ue=d.showPreviewEmail,_e=d.tabName,ce=d.reminderLabels,ve=d.reminderColors,fe=d.reminderChipColor,me=d.reminderAssignees,pe=d.reminderFallbackRecipients,ge=d.reminderRecipientsColor,Re=d.manualReminderTitle,Se=d.manualReminderDescription,Ee=d.lastReminderText,De=d.selectRecipientsLabel,Ae=d.previewEmailButtonLabel,ye=d.sendNowButtonLabel,Le=d.reminderSuccessTitle,he=d.reminderSuccessDescription,be=d.escalationTitle,Te=d.escalationTitleTooltip,Ne=d.escalationDescription,xe=d.configureAutoReminderText,Ie=d.getDynamicStatement,Pe=d.reminderStartDateLabel,we=d.documentDueDateLabel,Me=d.reminderFrequencyLabel,je=d.escalationRemindersLabel,Fe=d.escalationTooltip,qe=d.escalationConditionText,Ce=d.daysText,Be=d.dueDataAndRepeatText,We=d.reminderFrequencyOptions,Ue=d.escalationFrequencyOptions,Ge=d.beforeAfterOptions,Ye=u.default.useMemo(function(){var e;return(null===(e=L.tabData)||void 0===e?void 0:e.length)?L.tabData:c},[L.tabData]),Oe=u.default.useMemo(function(){return Ye.filter(function(e){var n=f(e.tabName);return!((!J||K)&&"assignees"===n)&&(!Z||"reminders"!==n)})},[Ye,J,K,Z]),ke=a.useState(null!==(D=null===(R=Oe[0])||void 0===R?void 0:R.tabName)&&void 0!==D?D:""),He=ke[0],ze=ke[1],Ve=f(He),Je=u.default.useMemo(function(){return g(T||_)},[]),Xe=a.useState(Je),Ke=Xe[0],Qe=Xe[1],Ze=a.useState(x||!1),$e=Ze[0],en=Ze[1],nn=a.useState(P||null),an=nn[0],sn=nn[1],tn=u.default.useRef(!1),rn=u.default.useRef(!1),ln=u.default.useRef(!1),on=u.default.useRef(S(Je)),dn=u.default.useRef(!!x),un=u.default.useRef(E(P||null)),_n=u.default.useCallback(function(e){tn.current=!0,Qe(e)},[]),cn=u.default.useCallback(function(e){rn.current=!0,en(e)},[]),vn=u.default.useCallback(function(e){ln.current=!0,sn(e)},[]),fn=a.useState(null),mn=fn[0],pn=fn[1],gn=a.useState([]),Rn=gn[0],Sn=gn[1],En=a.useState(te||v),Dn=En[0],An=En[1],yn=void 0!==le?le:Rn,Ln=void 0!==oe?oe:Sn,hn=void 0!==te?te:Dn,bn=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},Tn=function(){return bn(new Date)},Nn=u.default.useMemo(function(){return{due_at:an?an.toISOString():"",assignee:Ke.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,a){var s;return e.__assign(e.__assign({},n),((s={})[a]=i,s))},{})}},[an,Ke]);a.useEffect(function(){void 0!==te&&An(te)},[te]),a.useEffect(function(){z&&z().then(function(e){Array.isArray(e)&&e.length>0?pn(e[0]):e&&!Array.isArray(e)&&pn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),a.useEffect(function(){_e&&Oe.some(function(e){return e.tabName===_e})&&ze(_e)},[_e,Oe]),a.useEffect(function(){var e,n;Oe.some(function(e){return e.tabName===He})||ze(null!==(n=null===(e=Oe[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[Oe,He]),a.useEffect(function(){if(T){var e=g(T,Ke),n=S(e),i=S(Ke);n!==on.current&&(tn.current&&n!==i||(on.current=n,tn.current=!1,n!==i&&Qe(e)))}},[T,Ke]),a.useEffect(function(){if(void 0!==x){var e=!!x;e!==dn.current&&(rn.current&&e!==$e||(dn.current=e,rn.current=!1,e!==$e&&en(e)))}},[x,$e]),a.useEffect(function(){if(void 0!==P){var e=null!=P?P:null,n=E(e),i=E(an);n!==un.current&&(ln.current&&n!==i||(un.current=n,ln.current=!1,n!==i&&sn(e)))}},[P,an]),a.useEffect(function(){Qe(function(n){var i,a=n.filter(function(e){return!e.isHidden}),s=n.find(function(e){return e.isHidden});if($e){var t=null===(i=null==s?void 0:s.assignees)||void 0===i?void 0:i[0],r=e.__assign(e.__assign({},t),{id:(null==t?void 0:t.id)||(null==mn?void 0:mn.id)||"me",email:(null==t?void 0:t.email)||(null==mn?void 0:mn.email)||"",name:A(t,mn),accessLevel:(null==t?void 0:t.accessLevel)||"Approve",role:(null==t?void 0:t.role)||"Final Approver"}),l=e.__assign(e.__assign({},s),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[r]});return p(e.__spreadArray(e.__spreadArray([],a,!0),[l],!1))}return p(a)})},[$e,mn]),a.useEffect(function(){var e=Ke.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});An(function(n){var i=n.length===e.length&&e.every(function(e,i){var a;return(null===(a=n[i])||void 0===a?void 0:a.email)===e.email});return i?n:e.map(function(e,i){var a=n.find(function(n){return n.email===e.email});return a||{id:i+1,name:e.name,email:e.email,reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}})})},[Ke]);var xn=Ke.filter(function(e){return!e.isHidden}),In=xn.reduce(function(e,n){if(!n.dueDate)return e;var i=bn(n.dueDate);return!e||i>e?i:e},null),Pn=In&&In>Tn()?In:Tn(),wn=xn.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,a=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!a}),Mn=!1!==L.showFinalApprovalDueDate,jn=O||(!!wn||Mn&&!an),Fn=L.wrapperTitle||"Assign Redline and Manage Reminders",qn=L.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Cn=L.wrapperPriority||"High",Bn=L.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.overlay),G.overlay)},{children:n.jsxs("div",e.__assign({style:e.__assign(e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===Ve?{width:"1400px",maxWidth:"95vw"}:{}),G.modal)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.header),G.header)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.headerLeft),G.headerLeft)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modalTitle),G.modalTitle)},{children:Fn})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineRow),G.redlineRow)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineName),G.redlineName)},{children:qn})),n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineBadge),Bn),G.redlineBadge)},{children:Cn}))]}))]})),n.jsx("button",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.closeBtn),G.closeBtn),onClick:M},{children:n.jsx(i.X,{size:20,color:"#6B7280"})}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabBar),G.tabBar)},{children:Oe.map(function(i){var a=He===i.tabName;return n.jsxs("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tab),G.tab),a?e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabActive),G.tabActive):{}),onClick:function(){return ze(i.tabName)}},{children:[i.tabIcon," ",i.tabName]}),i.tabName)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.body),G.body)},{children:["assignees"===Ve&&n.jsxs(n.Fragment,{children:[!1!==L.showFinalApprovalDueDate&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateBar),G.dueDateBar)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateLabel),G.dueDateLabel)},{children:["Final Approval due date"," ",n.jsx("sup",e.__assign({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateInputWrap),G.dueDateInputWrap)},{children:n.jsx(r.default,{value:an?an.toISOString().slice(0,10):"",onChange:function(e){var n="function"==typeof e?e(an):e;n&&bn(n)<Pn?null==q||q("Final approval due date cannot be before the latest level due date"):vn(n?bn(n):null)},minDate:Pn,disabled:H.disableDueDates})})),n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.requiredToProceeed),G.requiredToProceeed)},{children:[n.jsx(i.CircleAlert,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),n.jsx(s.AssignReminderLevels,{levels:Ke,totalLevels:W,requireFinalApproval:$e,setLevels:_n,setRequireFinalApproval:function(e){cn(e)},fetchUsers:j,onValidationError:q,customStyles:G,finalApprovalDueDate:an,displayConfig:H})]}),"reminders"===Ve&&n.jsx(l.ManageReminders,e.__assign({data:Nn,schedules:yn,setSchedules:Ln,remainderOwners:hn,setRemainderOwners:function(e){var n="function"==typeof e?e(hn):e;re?re(n):An(n)},handelSendNow:function(e,n){de&&de(e||yn,n||hn)},showPreviewEmail:null!=ue&&ue},void 0!==ce&&{labels:ce},void 0!==ve&&{colors:ve},void 0!==fe&&{chipColor:fe},void 0!==me&&{assignees:me},void 0!==pe&&{fallbackRecipients:pe},void 0!==ge&&{recipientsColor:ge},void 0!==Re&&{manualReminderTitle:Re},void 0!==Se&&{manualReminderDescription:Se},void 0!==Ee&&{lastReminderText:Ee},void 0!==De&&{selectRecipientsLabel:De},void 0!==Ae&&{previewEmailButtonLabel:Ae},void 0!==ye&&{sendNowButtonLabel:ye},void 0!==Le&&{reminderSuccessTitle:Le},void 0!==he&&{reminderSuccessDescription:he},void 0!==be&&{escalationTitle:be},void 0!==Te&&{escalationTitleTooltip:Te},void 0!==Ne&&{escalationDescription:Ne},void 0!==xe&&{configureAutoReminderText:xe},void 0!==Ie&&{getDynamicStatement:Ie},void 0!==Pe&&{reminderStartDateLabel:Pe},void 0!==we&&{documentDueDateLabel:we},void 0!==Me&&{reminderFrequencyLabel:Me},void 0!==je&&{escalationRemindersLabel:je},void 0!==Fe&&{escalationTooltip:Fe},void 0!==qe&&{escalationConditionText:qe},void 0!==Ce&&{daysText:Ce},void 0!==Be&&{dueDataAndRepeatText:Be},void 0!==We&&{reminderFrequencyOptions:We},void 0!==Ue&&{escalationFrequencyOptions:Ue},void 0!==Ge&&{beforeAfterOptions:Ge})),"review"===Ve&&n.jsx(t.default,{levels:Ke,reviewData:b,showApproveAndMoveToNextLevelButton:C,onApproveAndMoveToNextLevel:B})]})),!se&&(!ee||!ie)&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.footer),G.footer)},{children:[!ee&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.clearBtn),G.clearBtn),O?G.actionBtnDisabled:{}),onClick:function(){_n(m(_.map(function(n){return e.__assign(e.__assign({},n),{assignees:[],dueDate:null})}))),cn(!1),vn(null)},disabled:O},{children:"Clear"})),!ie&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.saveBtn),G.saveBtn),jn?e.__assign({opacity:.55,cursor:"not-allowed"},G.actionBtnDisabled):{}),onClick:function(){if(jn)O||null==q||q(function(){if(Mn&&!an)return"Final approval due date is required";if(!wn)return"Please fill all required fields before saving";var e=xn.indexOf(wn)+1,n=[wn.dueDate?null:"due date",(wn.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})?null:"assignee"].filter(Boolean);return"Level ".concat(e," ").concat(n.join(" and ")," ").concat(n.length>1?"are":"is"," required")}());else{var e=p(Ke.filter(function(e){return!e.isHidden}));null==N||N(e),null==I||I($e),null==w||w(an),null==F||F({levels:e,requireFinalApproval:$e,finalApprovalDueDate:an,activeTab:Ve,schedules:yn,remainderOwners:hn})}},disabled:jn},{children:"Save Changes"}))]}))]}))}))},exports.INITIAL_LEVELS=_;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("lucide-react"),a=require("react"),t=require("./AssignReminderLevels.js"),r=require("./components/ReviewStatus.js"),s=require("./components/CustomDatePicker.js"),l=require("./utils/approvalDateValidation.js"),o=require("./ManageReminders.js"),d=require("./styles/AssignReminderWrapperStyles.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=u(a),c=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],v=[{tabName:"Assignees & Approvers",tabIcon:n.jsxs("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[n.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),n.jsx("circle",{cx:"9",cy:"7",r:"4"}),n.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),n.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:n.jsx(i.Bell,{size:15})},{tabName:"Review Status",tabIcon:n.jsx(i.ClipboardList,{size:15})}],f=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function m(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}var p=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e.__assign(e.__assign({},n),{isMandatory:!0,hasDueDate:!0})})},g=function(n){return n.map(function(n){var i;return e.__assign(e.__assign({},n),{assignees:(null!==(i=n.assignees)&&void 0!==i?i:[]).map(function(n){var i=n.accessLevel||n.role||"";return e.__assign(e.__assign({},n),{role:i,accessLevel:i})})})})},R=function(n,i){void 0===n&&(n=c),void 0===i&&(i=[]);var a=n.find(function(e){return e.isHidden}),t=i.find(function(e){return e.isHidden}),r=n.filter(function(e){return!e.isHidden}),s=a||t,l=s?e.__spreadArray(e.__spreadArray([],r,!0),[s],!1):r;return g(p(l))},S=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();return Number.isFinite(i)?n.toISOString():""},D=function(e){return void 0===e&&(e=[]),JSON.stringify(e.map(function(e){var n,i,a,t;return{headerName:null!==(n=e.headerName)&&void 0!==n?n:"",title:null!==(i=e.title)&&void 0!==i?i:"",isMandatory:!!e.isMandatory,hasDueDate:!!e.hasDueDate,isHidden:!!e.isHidden,dueDate:S(e.dueDate),status:null!==(a=e.status)&&void 0!==a?a:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(t=e.assignees)&&void 0!==t?t:[]).map(function(e){var n,i,a,t,r,s,l,o,d,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(a=e.email)&&void 0!==a?a:"",accessLevel:null!==(r=null!==(t=e.accessLevel)&&void 0!==t?t:e.role)&&void 0!==r?r:"",role:null!==(l=null!==(s=e.role)&&void 0!==s?s:e.accessLevel)&&void 0!==l?l:"",notes:null!==(o=e.notes)&&void 0!==o?o:"",sendMailNow:!!e.sendMailNow,action:null!==(d=e.action)&&void 0!==d?d:"",action_taken_at:null!==(u=e.action_taken_at)&&void 0!==u?u:""}})}}))},E=function(e){return S(e)},A=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();if(!Number.isFinite(i))return"";var a=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return"".concat(a,"-").concat(t,"-").concat(r)},y=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return"username (you)"===n||"username"===n},L=function(e,n){return y(null==e?void 0:e.name)?y(null==n?void 0:n.name)?(null==e?void 0:e.email)||(null==n?void 0:n.email)||"Owner":n.name:e.name};exports.AssignReminderWrapper=function(u){var S,y,h=u.metadata,b=void 0===h?{}:h,T=u.reviewData,N=void 0===T?{}:T,x=u.levels,I=u.setLevels,M=u.requireFinalApproval,P=u.setRequireFinalApproval,w=u.approvalDueDate,F=u.setApprovalDueDate,j=u.onClose,q=u.fetchUsers,C=u.onSave,B=u.onValidationError,W=u.showApproveAndMoveToNextLevelButton,U=u.onApproveAndMoveToNextLevel,Y=u.totalLevels,G=u.customStyles,O=void 0===G?{}:G,k=u.isSaving,H=void 0!==k&&k,z=u.displayConfig,V=void 0===z?{}:z,J=u.onRequireFinalApproval,X=u.isOwner,K=void 0===X||X,Q=u.blockEditScreen,Z=void 0!==Q&&Q,$=u.hideManageReminders,ee=void 0!==$&&$,ne=u.hideClearButton,ie=void 0!==ne&&ne,ae=u.hideSaveChangesButton,te=void 0!==ae&&ae,re=u.hideFooterActions,se=void 0!==re&&re;u.hideAssigneeApproverScreen,u.remindersData;var le=u.remainderOwners,oe=u.setRemainderOwners,de=u.schedules,ue=u.setSchedules,_e=u.handelSendNow,ce=u.showPreviewEmail,ve=u.tabName,fe=u.reminderLabels,me=u.reminderColors,pe=u.reminderChipColor,ge=u.reminderAssignees,Re=u.reminderFallbackRecipients,Se=u.reminderRecipientsColor,De=u.manualReminderTitle,Ee=u.manualReminderDescription,Ae=u.lastReminderText,ye=u.selectRecipientsLabel,Le=u.previewEmailButtonLabel,he=u.sendNowButtonLabel,be=u.reminderSuccessTitle,Te=u.reminderSuccessDescription,Ne=u.escalationTitle,xe=u.escalationTitleTooltip,Ie=u.escalationDescription,Me=u.configureAutoReminderText,Pe=u.getDynamicStatement,we=u.reminderStartDateLabel,Fe=u.documentDueDateLabel,je=u.reminderFrequencyLabel,qe=u.escalationRemindersLabel,Ce=u.escalationTooltip,Be=u.escalationConditionText,We=u.daysText,Ue=u.dueDataAndRepeatText,Ye=u.reminderFrequencyOptions,Ge=u.escalationFrequencyOptions,Oe=u.beforeAfterOptions,ke=_.default.useMemo(function(){var e;return(null===(e=b.tabData)||void 0===e?void 0:e.length)?b.tabData:v},[b.tabData]),He=_.default.useMemo(function(){return ke.filter(function(e){var n=m(e.tabName);return!((!K||Z)&&"assignees"===n)&&(!ee||"reminders"!==n)})},[ke,K,Z,ee]),ze=a.useState(null!==(y=null===(S=He[0])||void 0===S?void 0:S.tabName)&&void 0!==y?y:""),Ve=ze[0],Je=ze[1],Xe=m(Ve),Ke=_.default.useMemo(function(){return R(x||c)},[]),Qe=a.useState(Ke),Ze=Qe[0],$e=Qe[1],en=a.useState(M||!1),nn=en[0],an=en[1],tn=a.useState(w||null),rn=tn[0],sn=tn[1],ln=_.default.useRef(!1),on=_.default.useRef(!1),dn=_.default.useRef(!1),un=_.default.useRef(D(Ke)),_n=_.default.useRef(!!M),cn=_.default.useRef(E(w||null)),vn=_.default.useCallback(function(e){ln.current=!0,$e(e)},[]),fn=_.default.useCallback(function(e){on.current=!0,an(e)},[]),mn=_.default.useCallback(function(e){dn.current=!0,sn(e)},[]),pn=a.useState(null),gn=pn[0],Rn=pn[1],Sn=a.useState([]),Dn=Sn[0],En=Sn[1],An=a.useState(le||f),yn=An[0],Ln=An[1],hn=void 0!==de?de:Dn,bn=void 0!==ue?ue:En,Tn=void 0!==le?le:yn,Nn=function(){return l.startOfCalendarDay(new Date)},xn=_.default.useMemo(function(){return{due_at:rn?rn.toISOString():"",assignee:Ze.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,a){var t;return e.__assign(e.__assign({},n),((t={})[a]=i,t))},{})}},[rn,Ze]);a.useEffect(function(){void 0!==le&&Ln(le)},[le]),a.useEffect(function(){J&&J().then(function(e){Array.isArray(e)&&e.length>0?Rn(e[0]):e&&!Array.isArray(e)&&Rn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),a.useEffect(function(){ve&&He.some(function(e){return e.tabName===ve})&&Je(ve)},[ve,He]),a.useEffect(function(){var e,n;He.some(function(e){return e.tabName===Ve})||Je(null!==(n=null===(e=He[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[He,Ve]),a.useEffect(function(){if(x){var e=R(x,Ze),n=D(e),i=D(Ze);n!==un.current&&(ln.current&&n!==i||(un.current=n,ln.current=!1,n!==i&&$e(e)))}},[x,Ze]),a.useEffect(function(){if(void 0!==M){var e=!!M;e!==_n.current&&(on.current&&e!==nn||(_n.current=e,on.current=!1,e!==nn&&an(e)))}},[M,nn]),a.useEffect(function(){if(void 0!==w){var e=null!=w?w:null,n=E(e),i=E(rn);n!==cn.current&&(dn.current&&n!==i||(cn.current=n,dn.current=!1,n!==i&&sn(e)))}},[w,rn]),a.useEffect(function(){$e(function(n){var i,a=n.filter(function(e){return!e.isHidden}),t=n.find(function(e){return e.isHidden});if(nn){var r=null===(i=null==t?void 0:t.assignees)||void 0===i?void 0:i[0],s=e.__assign(e.__assign({},r),{id:(null==r?void 0:r.id)||(null==gn?void 0:gn.id)||"me",email:(null==r?void 0:r.email)||(null==gn?void 0:gn.email)||"",name:L(r,gn),accessLevel:(null==r?void 0:r.accessLevel)||"Approve",role:(null==r?void 0:r.role)||"Final Approver"}),l=e.__assign(e.__assign({},t),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[s]});return g(e.__spreadArray(e.__spreadArray([],a,!0),[l],!1))}return g(a)})},[nn,gn]),a.useEffect(function(){var e=Ze.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});Ln(function(n){var i=n.length===e.length&&e.every(function(e,i){var a;return(null===(a=n[i])||void 0===a?void 0:a.email)===e.email});return i?n:e.map(function(e,i){var a=n.find(function(n){return n.email===e.email});return a||{id:i+1,name:e.name,email:e.email,reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}})})},[Ze]);var In=Ze.filter(function(e){return!e.isHidden}),Mn=l.getLatestLevelDueDate(In),Pn=Mn&&Mn>Nn()?Mn:Nn(),wn=In.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,a=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!a}),Fn=!1!==b.showFinalApprovalDueDate,jn=!!wn||Fn&&!rn,qn=l.getApprovalDateValidationError(In,rn),Cn=H||jn||!!qn,Bn=b.wrapperTitle||"Assign Redline and Manage Reminders",Wn=b.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Un=b.wrapperPriority||"High",Yn=b.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return n.jsx("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.overlay),O.overlay)},{children:n.jsxs("div",e.__assign({style:e.__assign(e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===Xe?{width:"1400px",maxWidth:"95vw"}:{}),O.modal)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.header),O.header)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.headerLeft),O.headerLeft)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modalTitle),O.modalTitle)},{children:Bn})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineRow),O.redlineRow)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineName),O.redlineName)},{children:Wn})),n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineBadge),Yn),O.redlineBadge)},{children:Un}))]}))]})),n.jsx("button",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.closeBtn),O.closeBtn),onClick:j},{children:n.jsx(i.X,{size:20,color:"#6B7280"})}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabBar),O.tabBar)},{children:He.map(function(i){var a=Ve===i.tabName;return n.jsxs("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tab),O.tab),a?e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabActive),O.tabActive):{}),onClick:function(){return Je(i.tabName)}},{children:[i.tabIcon," ",i.tabName]}),i.tabName)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.body),O.body)},{children:["assignees"===Xe&&n.jsxs(n.Fragment,{children:[!1!==b.showFinalApprovalDueDate&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateBar),O.dueDateBar)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateLabel),O.dueDateLabel)},{children:["Final Approval due date"," ",n.jsx("sup",e.__assign({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateInputWrap),O.dueDateInputWrap)},{children:n.jsx(s.default,{value:A(rn),onChange:function(e){var n="function"==typeof e?e(rn):e;n&&l.startOfCalendarDay(n)<Pn?null==B||B("Final approval due date cannot be before the latest level due date"):mn(n?l.normalizeApprovalDate(n):null)},minDate:Pn,disabled:V.disableDueDates})})),n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.requiredToProceeed),O.requiredToProceeed)},{children:[n.jsx(i.CircleAlert,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),n.jsx(t.AssignReminderLevels,{levels:Ze,totalLevels:Y,requireFinalApproval:nn,setLevels:vn,setRequireFinalApproval:function(e){fn(e)},fetchUsers:q,onValidationError:B,customStyles:O,finalApprovalDueDate:rn,displayConfig:V})]}),"reminders"===Xe&&n.jsx(o.ManageReminders,e.__assign({data:xn,schedules:hn,setSchedules:bn,remainderOwners:Tn,setRemainderOwners:function(e){var n="function"==typeof e?e(Tn):e;oe?oe(n):Ln(n)},handelSendNow:function(e,n){_e&&_e(e||hn,n||Tn)},showPreviewEmail:null!=ce&&ce},void 0!==fe&&{labels:fe},void 0!==me&&{colors:me},void 0!==pe&&{chipColor:pe},void 0!==ge&&{assignees:ge},void 0!==Re&&{fallbackRecipients:Re},void 0!==Se&&{recipientsColor:Se},void 0!==De&&{manualReminderTitle:De},void 0!==Ee&&{manualReminderDescription:Ee},void 0!==Ae&&{lastReminderText:Ae},void 0!==ye&&{selectRecipientsLabel:ye},void 0!==Le&&{previewEmailButtonLabel:Le},void 0!==he&&{sendNowButtonLabel:he},void 0!==be&&{reminderSuccessTitle:be},void 0!==Te&&{reminderSuccessDescription:Te},void 0!==Ne&&{escalationTitle:Ne},void 0!==xe&&{escalationTitleTooltip:xe},void 0!==Ie&&{escalationDescription:Ie},void 0!==Me&&{configureAutoReminderText:Me},void 0!==Pe&&{getDynamicStatement:Pe},void 0!==we&&{reminderStartDateLabel:we},void 0!==Fe&&{documentDueDateLabel:Fe},void 0!==je&&{reminderFrequencyLabel:je},void 0!==qe&&{escalationRemindersLabel:qe},void 0!==Ce&&{escalationTooltip:Ce},void 0!==Be&&{escalationConditionText:Be},void 0!==We&&{daysText:We},void 0!==Ue&&{dueDataAndRepeatText:Ue},void 0!==Ye&&{reminderFrequencyOptions:Ye},void 0!==Ge&&{escalationFrequencyOptions:Ge},void 0!==Oe&&{beforeAfterOptions:Oe})),"review"===Xe&&n.jsx(r.default,{levels:Ze,reviewData:N,showApproveAndMoveToNextLevelButton:W,onApproveAndMoveToNextLevel:U})]})),!se&&(!ie||!te)&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.footer),O.footer)},{children:[!ie&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.clearBtn),O.clearBtn),H?O.actionBtnDisabled:{}),onClick:function(){vn(p(c.map(function(n){return e.__assign(e.__assign({},n),{assignees:[],dueDate:null})}))),fn(!1),mn(null)},disabled:H},{children:"Clear"})),!te&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.saveBtn),O.saveBtn),Cn?e.__assign({opacity:.55,cursor:"not-allowed"},O.actionBtnDisabled):{}),onClick:function(){if(Cn)H||null==B||B(qn||function(){if(Fn&&!rn)return"Final approval due date is required";if(!wn)return"Please fill all required fields before saving";var e=In.indexOf(wn)+1,n=[wn.dueDate?null:"due date",(wn.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})?null:"assignee"].filter(Boolean);return"Level ".concat(e," ").concat(n.join(" and ")," ").concat(n.length>1?"are":"is"," required")}());else{var e=g(Ze.filter(function(e){return!e.isHidden}));null==I||I(e),null==P||P(nn),null==F||F(rn),null==C||C({levels:e,requireFinalApproval:nn,finalApprovalDueDate:rn,activeTab:Xe,schedules:hn,remainderOwners:Tn})}},disabled:Cn},{children:"Save Changes"}))]}))]}))}))},exports.INITIAL_LEVELS=c;
|
|
2
2
|
//# sourceMappingURL=AssignReminderWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react"),t=require("@mui/material/Checkbox"),r=require("@mui/material"),l=require("framer-motion"),a=require("@mui/icons-material/DragIndicator"),o=require("@mui/x-date-pickers"),d=require("@mui/x-date-pickers/AdapterDayjs"),c=require("./components/ReminderFrequencyAutocomplete.js"),u=require("./components/AssigneeCalendarView.js"),y=require("dayjs"),_=require("./styles/ManageReminder.style.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=m(t),g=m(a),h=m(y),x=["Assignee 1","Assignee 2","Assignee 3"],f=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],p=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],j=[{id:"1",name:"Assignee 1",color:"#C11574",bg:"#FDF2F8",startDate:new Date("2026-11-09"),dueDate:new Date("2026-12-01")},{id:"2",name:"Assignee 2",color:"#3538CD",bg:"#EEF4FF",startDate:new Date("2026-11-21"),dueDate:new Date("2026-12-03")},{id:"3",name:"Assignee 3",color:"#FF6058",bg:"#FFF7ED",startDate:new Date("2026-12-01"),dueDate:new Date("2026-12-03")}],C=[{bg:"#DBEAFE",text:"#1E40AF"},{bg:"#CCFBF1",text:"#0D9488"},{bg:"#DCFCE7",text:"#166534"}],b=[{initials:"OR",name:"Olivia Rhye",checked:!1,bg:"#DBEAFE",text:"#1D4ED8"},{initials:"DM",name:"Daniela Mark",checked:!1,bg:"#CFFAFE",text:"#0F766E"},{initials:"JB",name:"Jenna Beckner",checked:!1,bg:"#D1FAE5",text:"#059669"}],F=function(e){var s,n,i,t,r,l,a,o;return(null==e?void 0:e.is_escalation_reminder)&&(null===(s=null==e?void 0:e.days)||void 0===s?void 0:s.value)&&"undefined"!==(null===(n=null==e?void 0:e.days)||void 0===n?void 0:n.value)&&(null===(i=null==e?void 0:e.escalation_reminder_frequency)||void 0===i?void 0:i.value)&&"undefined"!==(null===(t=null==e?void 0:e.escalation_reminder_frequency)||void 0===t?void 0:t.value)?"Start notifying ".concat((null===(r=null==e?void 0:e.days)||void 0===r?void 0:r.value.includes("day"))?null===(l=null==e?void 0:e.days)||void 0===l?void 0:l.value:"".concat(null===(a=null==e?void 0:e.days)||void 0===a?void 0:a.value," ").concat(1===Number(null===(o=null==e?void 0:e.days)||void 0===o?void 0:o.value)?"day":"days")," ").concat(null==e?void 0:e.before_or_after," the due date"):"Notify until successful document upload"},D={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}};exports.ManageReminders=function(t){var a=t.data,y=t.schedules,m=t.setSchedules,k=t.remainderOwners,R=t.setRemainderOwners,E=t.labels,S=void 0===E?x:E,w=t.colors,I=void 0===w?f:w,A=t.chipColor,B=void 0===A?p:A,T=t.assignees,q=void 0===T?j:T,P=t.fallbackRecipients,L=void 0===P?b:P,M=t.recipientsColor,O=void 0===M?C:M,Y=t.manualReminderTitle,N=void 0===Y?"Send Manual Reminder Now":Y,H=t.manualReminderDescription,z=void 0===H?"Immediately notify the assignees about this document.":H;t.lastReminderText;var W=t.selectRecipientsLabel,G=void 0===W?"Select recipients:":W,V=t.previewEmailButtonLabel,U=void 0===V?"Preview Email":V,J=t.sendNowButtonLabel,Z=void 0===J?"Send Now":J,K=t.reminderSuccessTitle,Q=void 0===K?"Reminder sent successfully!":K,X=t.reminderSuccessDescription,$=void 0===X?"Email notification sent to assignees.":X,ee=t.escalationTitle,se=void 0===ee?"Escalation and Auto Reminder Setup":ee;t.escalationTitleTooltip;var ne=t.escalationDescription,ie=void 0===ne?"Configure Auto reminder settings for all assignees.":ne;t.configureAutoReminderText;var te=t.getDynamicStatement,re=void 0===te?F:te,le=t.reminderStartDateLabel,ae=void 0===le?"Reminder Start Date":le,oe=t.documentDueDateLabel,de=void 0===oe?"Document Due Date":oe,ce=t.reminderFrequencyLabel,ue=void 0===ce?"Reminder Frequency":ce,ye=t.escalationRemindersLabel,_e=void 0===ye?"Escalation Reminders":ye;t.escalationTooltip;var me=t.escalationConditionText,ve=void 0===me?"If the document is still pending, start escalation reminders":me,ge=t.daysText,he=void 0===ge?"days":ge,xe=t.dueDataAndRepeatText,fe=void 0===xe?"due date and repeat every":xe,pe=t.reminderFrequencyOptions,je=void 0===pe?["12 hours","24 hours","48 hours","72 hours","Custom"]:pe,Ce=t.escalationFrequencyOptions,be=void 0===Ce?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:Ce,Fe=t.beforeAfterOptions,De=void 0===Fe?["After","Before"]:Fe,ke=t.handelSendNow,Re=t.showPreviewEmail,Ee=void 0===Re||Re,Se=n.useState(!1),we=Se[0],Ie=Se[1],Ae=n.useState(!1),Be=Ae[0],Te=Ae[1],qe=n.useState(!1),Pe=qe[0],Le=qe[1],Me=n.useState(!0),Oe=Me[0],Ye=Me[1],Ne=n.useState(L),He=Ne[0],ze=Ne[1],We=l.useDragControls(),Ge=function(s,n,i){R(function(t){return t.map(function(t,r){var l;return r===s?e.__assign(e.__assign({},t),((l={})[n]=i,l)):t})})},Ve=function(e,s){Ge(e,"reminder_start_date",s)},Ue=function(e){var s;if(!e)return null;if("custom"===e.type)return Number(e.value)<=0?null:60*Number(e.value)*60*1e3;return null!==(s={"1/2 hour":18e5,"1 hour":36e5,"4 hours":144e5,"6 hours":216e5,"12 hours":432e5,"24 hours":864e5,"48 hours":1728e5,"72 hours":2592e5,"96 hours":3456e5,"1/2 day":432e5,"1 day":864e5,"2 days":1728e5,"3 days":2592e5,"4 days":3456e5}[e.value])&&void 0!==s?s:null},Je=function(e,s,n){if(!e||!n)return[];var i=Ue(n);if(!i||i<=0)return[];for(var t=[],r=h.default(e).valueOf(),l=s?h.default(s).valueOf():h.default(e).add(45,"day").valueOf(),a=0;r<=l&&a<150;)t.push(h.default(r).toISOString()),r+=i,a++;return t},Ze=function(e,s,n,i){if(!(e&&s&&i&&n))return[];var t=Ue(i);if(!t)return[];var r,l=h.default(e),a="custom"===s.type?Number(s.value):Number("1/2"===s.value.split(" ")[0]?.5:Number(s.value.split(" ")[0])),o=[];switch(n){case"Before":r=l.subtract(a,"day");break;case"After":r=l.add(a,"day");break;default:return[]}for(var d=r.valueOf(),c=0;c<150;c++)o.push(h.default(d).toISOString()),d+=t;return o},Ke=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};n.useEffect(function(){var e=(null==a?void 0:a.due_at)||"",s=Object.values((null==a?void 0:a.assignee)||{}),n=null==k?void 0:k.map(function(n,i){var t,r=s[i]||q.find(function(e){return e.id===String(n.id)}),l=(null===(t=null==I?void 0:I[i%I.length])||void 0===t?void 0:t.text)||"#C11574";return{ownerId:n.id||i+1,ownerName:(null==r?void 0:r.name)||n.name,ownerColor:(null==r?void 0:r.color)||l,reminders:Je(n.reminder_start_date,e,n.reminder_frequency),escalations:Ze(e,n.days,n.before_or_after,n.escalation_reminder_frequency)}});m(n)},[k,null==a?void 0:a.due_at,null==a?void 0:a.assignee]),n.useEffect(function(){(null==a?void 0:a.assignee)&&ze(function(e){var s=Object.values(a.assignee).filter(function(e){return e&&Object.keys(e).length>0}).map(function(s,n){var i=e.find(function(e){return e.name===s.name});return{name:s.name,checked:!!i&&i.checked,recipientsColor:(null==O?void 0:O[n])||C[n%C.length]}});return s.length>0?s:L})},[null==a?void 0:a.assignee,null==a?void 0:a.due_at]);var Qe=Object.values((null==a?void 0:a.assignee)||{}).filter(function(e){return null==e?void 0:e.name});return s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrContainer),{width:"100%",minWidth:"850px"})},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionBox},{children:[s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrSectionHeader),{cursor:"pointer"}),onClick:function(){return Ie(function(e){return!e})}},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionHeaderContent},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionHeaderLeft},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionTitleWrapper},{children:[s.jsx("div",e.__assign({style:_.styles.mrSectionTitleIcon},{children:s.jsx(i.Send,{style:_.styles.mrIconSmall})})),s.jsx("div",e.__assign({style:_.styles.mrSectionTitle},{children:N}))]})),s.jsx("div",e.__assign({style:_.styles.mrSectionDescription},{children:z}))]})),s.jsx("div",e.__assign({style:_.styles.mrSectionHeaderRight},{children:s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Ie(function(e){return!e})},style:_.styles.mrChevronButton},{children:s.jsx(i.ChevronDown,{style:e.__assign(e.__assign({},_.styles.mrChevronIcon),we?_.styles.mrChevronRotated:{})})}))}))]})),s.jsx(l.AnimatePresence,{children:Pe&&s.jsxs(l.motion.div,e.__assign({initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:_.styles.mrSuccessMessage},{children:[s.jsx("div",e.__assign({style:_.styles.mrSuccessIcon},{children:s.jsx("div",e.__assign({style:_.styles.mrSuccessIconInner},{children:s.jsx(i.CircleCheckBigIcon,{style:_.styles.mrIconSuccess})}))})),s.jsxs("div",e.__assign({style:_.styles.mrSuccessText},{children:[s.jsx("div",e.__assign({style:_.styles.mrSuccessTitle},{children:Q})),s.jsx("div",e.__assign({style:_.styles.mrSuccessDescription},{children:$}))]}))]}))})]})),s.jsx(l.AnimatePresence,{children:we&&s.jsxs(l.motion.div,e.__assign({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:e.__assign(e.__assign({},_.styles.mrHiddenSection),{pointerEvents:we?"auto":"none"})},{children:[s.jsxs("div",e.__assign({style:_.styles.mrRecipientsSection},{children:[s.jsx("div",e.__assign({style:_.styles.mrRecipientsLabel},{children:G})),s.jsx("div",e.__assign({style:_.styles.mrRecipientsGrid},{children:He.map(function(n,i){var t,r,l,a,o=(null===(t=null==n?void 0:n.recipientsColor)||void 0===t?void 0:t.bg)||(null==n?void 0:n.bg)||(null===(r=C[i%C.length])||void 0===r?void 0:r.bg)||"#DBEAFE",d=(null===(l=null==n?void 0:n.recipientsColor)||void 0===l?void 0:l.text)||(null==n?void 0:n.text)||(null===(a=C[i%C.length])||void 0===a?void 0:a.text)||"#1E40AF";return s.jsxs("div",e.__assign({style:_.styles.mrRecipientItem},{children:[s.jsx(v.default,{checked:n.checked,onChange:function(){return s=n.name,void ze(function(n){return n.map(function(n){return n.name===s?e.__assign(e.__assign({},n),{checked:!n.checked}):n})});var s},onClick:function(e){return e.stopPropagation()},size:"small",disableRipple:!0,icon:s.jsx("div",{style:_.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:_.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.styles.mrCheckboxIcon},{children:s.jsx("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),s.jsxs("div",e.__assign({style:_.styles.mrRecipientInfo},{children:[s.jsx("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrRecipientAvatar),{backgroundColor:o,color:d})},{children:Ke(n.name)})),s.jsx("div",e.__assign({style:_.styles.mrRecipientName},{children:n.name}))]}))]}),n.name)})}))]})),s.jsxs("div",e.__assign({style:_.styles.mrActionsSection},{children:[Ee&&s.jsxs("button",e.__assign({onClick:function(e){e.stopPropagation()},type:"button",style:e.__assign(e.__assign({},_.styles.mrActionButton),_.styles.mrActionButtonSecondary)},{children:[s.jsx(i.Mail,{style:_.styles.mrIconAction}),U]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Le(!0),setTimeout(function(){return Le(!1)},3e3);var s=He.filter(function(e){return e.checked});ke(y,k.filter(function(e){return s.some(function(s){return s.id===e.id})}))},style:e.__assign(e.__assign({},_.styles.mrActionButton),_.styles.mrActionButtonPrimary)},{children:Z}))]}))]}))})]})),s.jsxs("div",e.__assign({style:_.styles.mrMainContent},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationContainer},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Te(function(e){return!e})}},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationHeader},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationTitleWrapper},{children:[s.jsx("div",e.__assign({style:_.styles.mrEscalationTitleText},{children:se})),s.jsx("div",e.__assign({style:_.styles.mrTooltipIcon},{children:s.jsx(i.InfoIcon,{stroke:"#64748B",style:_.styles.mrIconInfo})}))]})),s.jsxs("div",e.__assign({style:_.styles.mrEscalationActions},{children:[Ee&&s.jsxs("button",e.__assign({style:_.styles.mrEscalationPreviewButton},{children:[s.jsx("div",e.__assign({style:_.styles.mrEscalationPreviewIcon},{children:s.jsx(i.Mail,{style:_.styles.mrIconPreview})})),s.jsx("span",e.__assign({style:_.styles.mrEscalationPreviewText},{children:U}))]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Te(function(e){return!e})},style:_.styles.mrChevronButton},{children:s.jsx(i.ChevronDown,{style:e.__assign(e.__assign({},_.styles.mrChevronIcon),Be?_.styles.mrChevronRotated:{})})}))]}))]})),s.jsx("div",e.__assign({style:_.styles.mrEscalationDescription},{children:ie}))]})),s.jsx(l.AnimatePresence,e.__assign({initial:!1},{children:Be&&s.jsx(l.motion.div,e.__assign({layout:!0,initial:{opacity:0,scaleY:.96},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:.96},transition:{duration:.3,ease:"easeInOut"},style:{transformOrigin:"top",overflow:"hidden"}},{children:s.jsx(l.Reorder.Group,e.__assign({axis:"y",values:k||[],onReorder:function(e){R(e)},layoutScroll:!0,style:_.styles.mrReorderGroup},{children:null==k?void 0:k.map(function(n,t){var u,y,m,x,f=Qe[t]||L[t],p=(null===(u=null==I?void 0:I[t])||void 0===u?void 0:u.bg)||"#FDF2FA",j=(null===(y=null==I?void 0:I[t])||void 0===y?void 0:y.text)||"#C11574",C=(null===(m=null==B?void 0:B[t])||void 0===m?void 0:m.bg)||"transparent",b=(null===(x=null==B?void 0:B[t])||void 0===x?void 0:x.text)||"inherit";return s.jsx(l.Reorder.Item,e.__assign({value:n,dragControls:We,layout:"position"},{children:s.jsxs("div",e.__assign({style:_.styles.mrReminderItem},{children:[s.jsx("div",e.__assign({style:_.styles.mrReminderLabelBox},{children:s.jsx("div",e.__assign({style:_.styles.mrReminderLabelInner},{children:s.jsx(r.Chip,{label:(null==S?void 0:S[t])||"Assignee ".concat(t+1),sx:{backgroundColor:p,minWidth:90,color:j,fontWeight:500}})}))})),s.jsxs("div",e.__assign({style:_.styles.mrReminderContent},{children:[s.jsx("div",e.__assign({style:_.styles.mrDragHandle},{children:s.jsx(g.default,{onPointerDown:function(e){return We.start(e)},sx:{color:"#9e9e9e"}})})),s.jsx(r.Box,e.__assign({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:_.styles.mrReminderBox},{children:s.jsxs("div",e.__assign({style:_.styles.mrReminderFields},{children:[s.jsxs("div",e.__assign({style:_.styles.mrReminderHeader},{children:[s.jsxs("div",e.__assign({style:_.styles.mrReminderAssignee},{children:[s.jsx("div",e.__assign({style:_.styles.mrReminderAvatar},{children:s.jsx("span",e.__assign({style:_.styles.mrReminderInitials},{children:Ke(null==f?void 0:f.name)}))})),s.jsx("span",e.__assign({style:_.styles.mrReminderName},{children:null==f?void 0:f.name}))]})),s.jsx("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrReminderStatement),{backgroundColor:C})},{children:s.jsx("span",e.__assign({style:e.__assign(e.__assign({},_.styles.mrReminderStatementText),{color:b})},{children:re(n)}))}))]})),s.jsxs("div",e.__assign({style:_.styles.mrReminderDateFields},{children:[s.jsxs("div",e.__assign({style:_.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:_.styles.mrReminderFieldLabel},{children:ae})),s.jsxs("div",e.__assign({style:_.styles.mrReminderDatePicker},{children:[s.jsx(o.LocalizationProvider,e.__assign({dateAdapter:d.AdapterDayjs},{children:s.jsx(o.DatePicker,{value:n.reminder_start_date?h.default(n.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&h.default(e).isValid()){if(h.default(e).isBefore(h.default(),"day"))return;Ve(t,h.default(e).toISOString())}else Ve(t,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:D,placeholder:"MM/DD/YYYY"},openPickerButton:{id:"trial-start-date-picker-icon","data-testid":"trial-start-date-picker-icon",size:"small"},openPickerIcon:{sx:{fontSize:"14px"}}}})})),s.jsx(i.ArrowRight,{style:_.styles.mrIconArrow})]}))]})),s.jsxs("div",e.__assign({style:_.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:_.styles.mrReminderFieldLabel},{children:de})),s.jsx("div",e.__assign({style:_.styles.mrReminderDueDate},{children:(null==a?void 0:a.due_at)?h.default(a.due_at).format("MM/DD/YYYY"):""}))]})),s.jsxs("div",e.__assign({style:_.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:_.styles.mrReminderFieldLabel},{children:ue})),s.jsxs("div",e.__assign({style:_.styles.mrReminderFrequency},{children:[s.jsx("span",e.__assign({style:_.styles.mrReminderFrequencyText},{children:"Every"})),s.jsx(c.default,{value:n.reminder_frequency,onChange:function(e){return function(e,s){Ge(e,"reminder_frequency",s)}(t,e)},options:je,suffix:"hours"})]}))]}))]})),s.jsxs("div",e.__assign({style:_.styles.mrEscalationCheckbox},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationCheckboxHeader},{children:[s.jsx(v.default,{size:"small",disableRipple:!0,checked:n.is_escalation_reminder,onChange:function(e){return function(e,s){Ge(e,"is_escalation_reminder",s),s||(Ge(e,"days",{type:"preset",value:""}),Ge(e,"escalation_reminder_frequency",{type:"preset",value:""}),Ge(e,"before_or_after",""))}(t,e.target.checked)},icon:s.jsx("div",{style:_.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:_.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.styles.mrCheckboxIcon},{children:s.jsx("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),_e,s.jsx("div",e.__assign({style:_.styles.mrTooltipIcon},{children:s.jsx(i.InfoIcon,{stroke:"#64748B",style:_.styles.mrIconInfo})}))]})),s.jsx(l.AnimatePresence,{children:n.is_escalation_reminder&&s.jsxs(l.motion.div,e.__assign({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:_.styles.mrEscalationContent},{children:[s.jsx("div",e.__assign({style:_.styles.mrEscalationCondition},{children:ve})),s.jsxs("div",e.__assign({style:_.styles.mrEscalationFields},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationFieldGroup},{children:[s.jsx(c.default,{value:n.days,onChange:function(e){return function(e,s){Ge(e,"days",s)}(t,e)}}),s.jsx("div",e.__assign({style:_.styles.mrEscalationFieldText},{children:he}))]})),s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrEscalationFieldGroup),_.styles.mrEscalationFieldGroupLarge)},{children:[s.jsx(r.Autocomplete,{size:"small",options:De,value:n.before_or_after,onChange:function(e,s){return function(e,s){Ge(e,"before_or_after",s)}(t,s||"")},popupIcon:s.jsx(i.ChevronDown,{style:_.styles.mrIconDropdown}),slotProps:{paper:{sx:{"& .MuiAutocomplete-option":{fontSize:"12px",minHeight:"32px"}}},clearIndicator:{sx:{"& svg":{fontSize:12}}}},renderInput:function(n){return s.jsx(r.TextField,e.__assign({},n,{placeholder:"Select value",sx:D}))},sx:{width:"100%"}}),s.jsx("div",e.__assign({style:_.styles.mrEscalationFieldText},{children:fe}))]})),s.jsx("div",e.__assign({style:_.styles.mrEscalationFieldGroupSmall},{children:s.jsx(c.default,{value:n.escalation_reminder_frequency,onChange:function(e){return function(e,s){Ge(e,"escalation_reminder_frequency",s)}(t,e)},options:be,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))}),n.id||t)})}))}))}))]})),Be&&s.jsxs(l.motion.div,e.__assign({initial:{width:Oe?"345px":"43px"},animate:{width:Oe?"345px":"43px"},transition:{duration:.3},style:_.styles.mrCalendarPanel},{children:[Oe?s.jsx(u.default,{assignees:y}):s.jsx("div",e.__assign({style:_.styles.mrCalendarCollapsed},{children:s.jsx(i.CalendarIcon,{style:_.styles.mrIconCalendar})})),s.jsxs("button",e.__assign({onClick:function(){return Ye(function(e){return!e})},style:_.styles.mrCalendarToggle},{children:[s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50",fill:"none"},{children:s.jsx("path",{d:"M3.94434 9.65137C1.79601 11.031 0.49707 13.4087 0.49707 15.9619V35.1436C0.49707 37.8496 1.95476 40.346 4.31152 41.6758L17.5469 49.1426V0.915039L3.94434 9.65137Z",fill:"white",stroke:"#E0E0E0"})})),Oe?s.jsx(i.ChevronRight,{style:_.styles.mrIconChevronToggle}):s.jsx(i.ChevronLeft,{style:_.styles.mrIconChevronToggle})]}))]}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),i=require("react"),n=require("lucide-react"),t=require("@mui/material/Checkbox"),r=require("@mui/material"),l=require("framer-motion"),a=require("@mui/icons-material/DragIndicator"),o=require("@mui/x-date-pickers"),d=require("@mui/x-date-pickers/AdapterDayjs"),c=require("./components/ReminderFrequencyAutocomplete.js"),u=require("./components/AssigneeCalendarView.js"),y=require("dayjs"),_=require("./styles/ManageReminder.style.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=m(t),g=m(a),h=m(y),x=["Assignee 1","Assignee 2","Assignee 3"],f=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],p=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],j=[{id:"1",name:"Assignee 1",color:"#C11574",bg:"#FDF2F8",startDate:new Date("2026-11-09"),dueDate:new Date("2026-12-01")},{id:"2",name:"Assignee 2",color:"#3538CD",bg:"#EEF4FF",startDate:new Date("2026-11-21"),dueDate:new Date("2026-12-03")},{id:"3",name:"Assignee 3",color:"#FF6058",bg:"#FFF7ED",startDate:new Date("2026-12-01"),dueDate:new Date("2026-12-03")}],C=[{bg:"#DBEAFE",text:"#1E40AF"},{bg:"#CCFBF1",text:"#0D9488"},{bg:"#DCFCE7",text:"#166534"}],b=[{initials:"OR",name:"Olivia Rhye",checked:!1,bg:"#DBEAFE",text:"#1D4ED8"},{initials:"DM",name:"Daniela Mark",checked:!1,bg:"#CFFAFE",text:"#0F766E"},{initials:"JB",name:"Jenna Beckner",checked:!1,bg:"#D1FAE5",text:"#059669"}],F=function(e){var s,i,n,t,r,l,a,o;return(null==e?void 0:e.is_escalation_reminder)&&(null===(s=null==e?void 0:e.days)||void 0===s?void 0:s.value)&&"undefined"!==(null===(i=null==e?void 0:e.days)||void 0===i?void 0:i.value)&&(null===(n=null==e?void 0:e.escalation_reminder_frequency)||void 0===n?void 0:n.value)&&"undefined"!==(null===(t=null==e?void 0:e.escalation_reminder_frequency)||void 0===t?void 0:t.value)?"Start notifying ".concat((null===(r=null==e?void 0:e.days)||void 0===r?void 0:r.value.includes("day"))?null===(l=null==e?void 0:e.days)||void 0===l?void 0:l.value:"".concat(null===(a=null==e?void 0:e.days)||void 0===a?void 0:a.value," ").concat(1===Number(null===(o=null==e?void 0:e.days)||void 0===o?void 0:o.value)?"day":"days")," ").concat(null==e?void 0:e.before_or_after," the due date"):"Notify until successful document upload"},D={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}};exports.ManageReminders=function(t){var a=t.data,y=t.schedules,m=t.setSchedules,k=t.remainderOwners,R=t.setRemainderOwners,E=t.labels,S=void 0===E?x:E,w=t.colors,I=void 0===w?f:w,A=t.chipColor,B=void 0===A?p:A,T=t.assignees,q=void 0===T?j:T,P=t.fallbackRecipients,L=void 0===P?b:P,M=t.recipientsColor,O=void 0===M?C:M,Y=t.manualReminderTitle,N=void 0===Y?"Send Manual Reminder Now":Y,H=t.manualReminderDescription,z=void 0===H?"Immediately notify the assignees about this document.":H;t.lastReminderText;var W=t.selectRecipientsLabel,G=void 0===W?"Select recipients:":W,V=t.previewEmailButtonLabel,U=void 0===V?"Preview Email":V,J=t.sendNowButtonLabel,Z=void 0===J?"Send Now":J,K=t.reminderSuccessTitle,Q=void 0===K?"Reminder sent successfully!":K,X=t.reminderSuccessDescription,$=void 0===X?"Email notification sent to assignees.":X,ee=t.escalationTitle,se=void 0===ee?"Escalation and Auto Reminder Setup":ee;t.escalationTitleTooltip;var ie=t.escalationDescription,ne=void 0===ie?"Configure Auto reminder settings for all assignees.":ie;t.configureAutoReminderText;var te=t.getDynamicStatement,re=void 0===te?F:te,le=t.reminderStartDateLabel,ae=void 0===le?"Reminder Start Date":le,oe=t.documentDueDateLabel,de=void 0===oe?"Document Due Date":oe,ce=t.reminderFrequencyLabel,ue=void 0===ce?"Reminder Frequency":ce,ye=t.escalationRemindersLabel,_e=void 0===ye?"Escalation Reminders":ye;t.escalationTooltip;var me=t.escalationConditionText,ve=void 0===me?"If the document is still pending, start escalation reminders":me,ge=t.daysText,he=void 0===ge?"days":ge,xe=t.dueDataAndRepeatText,fe=void 0===xe?"due date and repeat every":xe,pe=t.reminderFrequencyOptions,je=void 0===pe?["12 hours","24 hours","48 hours","72 hours","Custom"]:pe,Ce=t.escalationFrequencyOptions,be=void 0===Ce?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:Ce,Fe=t.beforeAfterOptions,De=void 0===Fe?["After","Before"]:Fe,ke=t.handelSendNow,Re=t.showPreviewEmail,Ee=void 0===Re||Re,Se=i.useState(!1),we=Se[0],Ie=Se[1],Ae=i.useState(!1),Be=Ae[0],Te=Ae[1],qe=i.useState(!1),Pe=qe[0],Le=qe[1],Me=i.useState(!0),Oe=Me[0],Ye=Me[1],Ne=i.useState(L),He=Ne[0],ze=Ne[1],We=l.useDragControls(),Ge=function(s,i,n){R(function(t){return t.map(function(t,r){var l;return r===s?e.__assign(e.__assign({},t),((l={})[i]=n,l)):t})})},Ve=function(e,s){Ge(e,"reminder_start_date",s)},Ue=function(e){var s;if(!e)return null;if("custom"===e.type)return Number(e.value)<=0?null:60*Number(e.value)*60*1e3;return null!==(s={"1/2 hour":18e5,"1 hour":36e5,"4 hours":144e5,"6 hours":216e5,"12 hours":432e5,"24 hours":864e5,"48 hours":1728e5,"72 hours":2592e5,"96 hours":3456e5,"1/2 day":432e5,"1 day":864e5,"2 days":1728e5,"3 days":2592e5,"4 days":3456e5}[e.value])&&void 0!==s?s:null},Je=function(e,s,i){if(!e||!i)return[];var n=Ue(i);if(!n||n<=0)return[];for(var t=[],r=h.default(e).valueOf(),l=s?h.default(s).valueOf():h.default(e).add(45,"day").valueOf(),a=0;r<=l&&a<150;)t.push(h.default(r).toISOString()),r+=n,a++;return t},Ze=function(e,s,i,n){if(!(e&&s&&n&&i))return[];var t=Ue(n);if(!t)return[];var r,l=h.default(e),a="custom"===s.type?Number(s.value):Number("1/2"===s.value.split(" ")[0]?.5:Number(s.value.split(" ")[0])),o=[];switch(i){case"Before":r=l.subtract(a,"day");break;case"After":r=l.add(a,"day");break;default:return[]}for(var d=r.valueOf(),c=0;c<150;c++)o.push(h.default(d).toISOString()),d+=t;return o},Ke=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};i.useEffect(function(){var e=(null==a?void 0:a.due_at)||"",s=Object.values((null==a?void 0:a.assignee)||{}),i=null==k?void 0:k.map(function(i,n){var t,r=s[n]||q.find(function(e){return e.id===String(i.id)}),l=(null===(t=null==I?void 0:I[n%I.length])||void 0===t?void 0:t.text)||"#C11574";return{ownerId:i.id||n+1,ownerName:(null==r?void 0:r.name)||i.name,ownerColor:(null==r?void 0:r.color)||l,reminders:Je(i.reminder_start_date,e,i.reminder_frequency),escalations:Ze(e,i.days,i.before_or_after,i.escalation_reminder_frequency)}});m(i)},[k,null==a?void 0:a.due_at,null==a?void 0:a.assignee]),i.useEffect(function(){(null==a?void 0:a.assignee)&&ze(function(e){var s=Object.values(a.assignee).filter(function(e){return e&&Object.keys(e).length>0}).map(function(s,i){var n=e.find(function(e){return e.name===s.name});return{name:s.name,checked:!!n&&n.checked,recipientsColor:(null==O?void 0:O[i])||C[i%C.length]}});return s.length>0?s:L})},[null==a?void 0:a.assignee,null==a?void 0:a.due_at]);var Qe=Object.values((null==a?void 0:a.assignee)||{}).filter(function(e){return null==e?void 0:e.name});return s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrContainer),{width:"100%",minWidth:"850px"})},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionBox},{children:[s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrSectionHeader),{cursor:"pointer"}),onClick:function(){we||Ie(!0)}},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionHeaderContent},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionHeaderLeft},{children:[s.jsxs("div",e.__assign({style:_.styles.mrSectionTitleWrapper},{children:[s.jsx("div",e.__assign({style:_.styles.mrSectionTitleIcon},{children:s.jsx(n.Send,{style:_.styles.mrIconSmall})})),s.jsx("div",e.__assign({style:_.styles.mrSectionTitle},{children:N}))]})),s.jsx("div",e.__assign({style:_.styles.mrSectionDescription},{children:z}))]})),s.jsx("div",e.__assign({style:_.styles.mrSectionHeaderRight},{children:s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Ie(function(e){return!e})},style:_.styles.mrChevronButton},{children:s.jsx(n.ChevronDown,{style:e.__assign(e.__assign({},_.styles.mrChevronIcon),we?_.styles.mrChevronRotated:{})})}))}))]})),s.jsx(l.AnimatePresence,{children:Pe&&s.jsxs(l.motion.div,e.__assign({initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:_.styles.mrSuccessMessage},{children:[s.jsx("div",e.__assign({style:_.styles.mrSuccessIcon},{children:s.jsx("div",e.__assign({style:_.styles.mrSuccessIconInner},{children:s.jsx(n.CircleCheckBigIcon,{style:_.styles.mrIconSuccess})}))})),s.jsxs("div",e.__assign({style:_.styles.mrSuccessText},{children:[s.jsx("div",e.__assign({style:_.styles.mrSuccessTitle},{children:Q})),s.jsx("div",e.__assign({style:_.styles.mrSuccessDescription},{children:$}))]}))]}))})]})),s.jsx(l.AnimatePresence,{children:we&&s.jsxs(l.motion.div,e.__assign({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:e.__assign(e.__assign({},_.styles.mrHiddenSection),{pointerEvents:we?"auto":"none"})},{children:[s.jsxs("div",e.__assign({style:_.styles.mrRecipientsSection},{children:[s.jsx("div",e.__assign({style:_.styles.mrRecipientsLabel},{children:G})),s.jsx("div",e.__assign({style:_.styles.mrRecipientsGrid},{children:He.map(function(i,n){var t,r,l,a,o=(null===(t=null==i?void 0:i.recipientsColor)||void 0===t?void 0:t.bg)||(null==i?void 0:i.bg)||(null===(r=C[n%C.length])||void 0===r?void 0:r.bg)||"#DBEAFE",d=(null===(l=null==i?void 0:i.recipientsColor)||void 0===l?void 0:l.text)||(null==i?void 0:i.text)||(null===(a=C[n%C.length])||void 0===a?void 0:a.text)||"#1E40AF";return s.jsxs("div",e.__assign({style:_.styles.mrRecipientItem},{children:[s.jsx(v.default,{checked:i.checked,onChange:function(){return s=i.name,void ze(function(i){return i.map(function(i){return i.name===s?e.__assign(e.__assign({},i),{checked:!i.checked}):i})});var s},onClick:function(e){return e.stopPropagation()},size:"small",disableRipple:!0,icon:s.jsx("div",{style:_.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:_.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.styles.mrCheckboxIcon},{children:s.jsx("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),s.jsxs("div",e.__assign({style:_.styles.mrRecipientInfo},{children:[s.jsx("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrRecipientAvatar),{backgroundColor:o,color:d})},{children:Ke(i.name)})),s.jsx("div",e.__assign({style:_.styles.mrRecipientName},{children:i.name}))]}))]}),i.name)})}))]})),s.jsxs("div",e.__assign({style:_.styles.mrActionsSection},{children:[Ee&&s.jsxs("button",e.__assign({onClick:function(e){e.stopPropagation()},type:"button",style:e.__assign(e.__assign({},_.styles.mrActionButton),_.styles.mrActionButtonSecondary)},{children:[s.jsx(n.Mail,{style:_.styles.mrIconAction}),U]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Le(!0),setTimeout(function(){return Le(!1)},3e3);var s=He.filter(function(e){return e.checked});ke(y,k.filter(function(e){return s.some(function(s){return s.id===e.id})}))},style:e.__assign(e.__assign({},_.styles.mrActionButton),_.styles.mrActionButtonPrimary)},{children:Z}))]}))]}))})]})),s.jsxs("div",e.__assign({style:_.styles.mrMainContent},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationContainer},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Be||Te(!0)}},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationHeader},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationTitleWrapper},{children:[s.jsx("div",e.__assign({style:_.styles.mrEscalationTitleText},{children:se})),s.jsx("div",e.__assign({style:_.styles.mrTooltipIcon},{children:s.jsx(n.InfoIcon,{stroke:"#64748B",style:_.styles.mrIconInfo})}))]})),s.jsxs("div",e.__assign({style:_.styles.mrEscalationActions},{children:[Ee&&s.jsxs("button",e.__assign({style:_.styles.mrEscalationPreviewButton},{children:[s.jsx("div",e.__assign({style:_.styles.mrEscalationPreviewIcon},{children:s.jsx(n.Mail,{style:_.styles.mrIconPreview})})),s.jsx("span",e.__assign({style:_.styles.mrEscalationPreviewText},{children:U}))]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Te(function(e){return!e})},style:_.styles.mrChevronButton},{children:s.jsx(n.ChevronDown,{style:e.__assign(e.__assign({},_.styles.mrChevronIcon),Be?_.styles.mrChevronRotated:{})})}))]}))]})),s.jsx("div",e.__assign({style:_.styles.mrEscalationDescription},{children:ne}))]})),s.jsx(l.AnimatePresence,e.__assign({initial:!1},{children:Be&&s.jsx(l.motion.div,e.__assign({layout:!0,initial:{opacity:0,scaleY:.96},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:.96},transition:{duration:.3,ease:"easeInOut"},style:{transformOrigin:"top",overflow:"hidden"}},{children:s.jsx(l.Reorder.Group,e.__assign({axis:"y",values:k||[],onReorder:function(e){R(e)},layoutScroll:!0,style:_.styles.mrReorderGroup},{children:null==k?void 0:k.map(function(i,t){var u,y,m,x,f=Qe[t]||L[t],p=(null===(u=null==I?void 0:I[t])||void 0===u?void 0:u.bg)||"#FDF2FA",j=(null===(y=null==I?void 0:I[t])||void 0===y?void 0:y.text)||"#C11574",C=(null===(m=null==B?void 0:B[t])||void 0===m?void 0:m.bg)||"transparent",b=(null===(x=null==B?void 0:B[t])||void 0===x?void 0:x.text)||"inherit";return s.jsx(l.Reorder.Item,e.__assign({value:i,dragControls:We,layout:"position"},{children:s.jsxs("div",e.__assign({style:_.styles.mrReminderItem},{children:[s.jsx("div",e.__assign({style:_.styles.mrReminderLabelBox},{children:s.jsx("div",e.__assign({style:_.styles.mrReminderLabelInner},{children:s.jsx(r.Chip,{label:(null==S?void 0:S[t])||"Assignee ".concat(t+1),sx:{backgroundColor:p,minWidth:90,color:j,fontWeight:500}})}))})),s.jsxs("div",e.__assign({style:_.styles.mrReminderContent},{children:[s.jsx("div",e.__assign({style:_.styles.mrDragHandle},{children:s.jsx(g.default,{onPointerDown:function(e){return We.start(e)},sx:{color:"#9e9e9e"}})})),s.jsx(r.Box,e.__assign({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:_.styles.mrReminderBox},{children:s.jsxs("div",e.__assign({style:_.styles.mrReminderFields},{children:[s.jsxs("div",e.__assign({style:_.styles.mrReminderHeader},{children:[s.jsxs("div",e.__assign({style:_.styles.mrReminderAssignee},{children:[s.jsx("div",e.__assign({style:_.styles.mrReminderAvatar},{children:s.jsx("span",e.__assign({style:_.styles.mrReminderInitials},{children:Ke(null==f?void 0:f.name)}))})),s.jsx("span",e.__assign({style:_.styles.mrReminderName},{children:null==f?void 0:f.name}))]})),s.jsx("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrReminderStatement),{backgroundColor:C})},{children:s.jsx("span",e.__assign({style:e.__assign(e.__assign({},_.styles.mrReminderStatementText),{color:b})},{children:re(i)}))}))]})),s.jsxs("div",e.__assign({style:_.styles.mrReminderDateFields},{children:[s.jsxs("div",e.__assign({style:_.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:_.styles.mrReminderFieldLabel},{children:ae})),s.jsxs("div",e.__assign({style:_.styles.mrReminderDatePicker},{children:[s.jsx(o.LocalizationProvider,e.__assign({dateAdapter:d.AdapterDayjs},{children:s.jsx(o.DatePicker,{value:i.reminder_start_date?h.default(i.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&h.default(e).isValid()){if(h.default(e).isBefore(h.default(),"day"))return;Ve(t,h.default(e).toISOString())}else Ve(t,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:D,placeholder:"MM/DD/YYYY"},openPickerButton:{id:"trial-start-date-picker-icon","data-testid":"trial-start-date-picker-icon",size:"small"},openPickerIcon:{sx:{fontSize:"14px"}}}})})),s.jsx(n.ArrowRight,{style:_.styles.mrIconArrow})]}))]})),s.jsxs("div",e.__assign({style:_.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:_.styles.mrReminderFieldLabel},{children:de})),s.jsx("div",e.__assign({style:_.styles.mrReminderDueDate},{children:(null==a?void 0:a.due_at)?h.default(a.due_at).format("MM/DD/YYYY"):""}))]})),s.jsxs("div",e.__assign({style:_.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:_.styles.mrReminderFieldLabel},{children:ue})),s.jsxs("div",e.__assign({style:_.styles.mrReminderFrequency},{children:[s.jsx("span",e.__assign({style:_.styles.mrReminderFrequencyText},{children:"Every"})),s.jsx(c.default,{value:i.reminder_frequency,onChange:function(e){return function(e,s){Ge(e,"reminder_frequency",s)}(t,e)},options:je,suffix:"hours"})]}))]}))]})),s.jsxs("div",e.__assign({style:_.styles.mrEscalationCheckbox},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationCheckboxHeader},{children:[s.jsx(v.default,{size:"small",disableRipple:!0,checked:i.is_escalation_reminder,onChange:function(e){return function(e,s){Ge(e,"is_escalation_reminder",s),s||(Ge(e,"days",{type:"preset",value:""}),Ge(e,"escalation_reminder_frequency",{type:"preset",value:""}),Ge(e,"before_or_after",""))}(t,e.target.checked)},icon:s.jsx("div",{style:_.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:_.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.styles.mrCheckboxIcon},{children:s.jsx("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),_e,s.jsx("div",e.__assign({style:_.styles.mrTooltipIcon},{children:s.jsx(n.InfoIcon,{stroke:"#64748B",style:_.styles.mrIconInfo})}))]})),s.jsx(l.AnimatePresence,{children:i.is_escalation_reminder&&s.jsxs(l.motion.div,e.__assign({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:_.styles.mrEscalationContent},{children:[s.jsx("div",e.__assign({style:_.styles.mrEscalationCondition},{children:ve})),s.jsxs("div",e.__assign({style:_.styles.mrEscalationFields},{children:[s.jsxs("div",e.__assign({style:_.styles.mrEscalationFieldGroup},{children:[s.jsx(c.default,{value:i.days,onChange:function(e){return function(e,s){Ge(e,"days",s)}(t,e)}}),s.jsx("div",e.__assign({style:_.styles.mrEscalationFieldText},{children:he}))]})),s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},_.styles.mrEscalationFieldGroup),_.styles.mrEscalationFieldGroupLarge)},{children:[s.jsx(r.Autocomplete,{size:"small",options:De,value:i.before_or_after,onChange:function(e,s){return function(e,s){Ge(e,"before_or_after",s)}(t,s||"")},popupIcon:s.jsx(n.ChevronDown,{style:_.styles.mrIconDropdown}),slotProps:{paper:{sx:{"& .MuiAutocomplete-option":{fontSize:"12px",minHeight:"32px"}}},clearIndicator:{sx:{"& svg":{fontSize:12}}}},renderInput:function(i){return s.jsx(r.TextField,e.__assign({},i,{placeholder:"Select value",sx:D}))},sx:{width:"100%"}}),s.jsx("div",e.__assign({style:_.styles.mrEscalationFieldText},{children:fe}))]})),s.jsx("div",e.__assign({style:_.styles.mrEscalationFieldGroupSmall},{children:s.jsx(c.default,{value:i.escalation_reminder_frequency,onChange:function(e){return function(e,s){Ge(e,"escalation_reminder_frequency",s)}(t,e)},options:be,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))}),i.id||t)})}))}))}))]})),Be&&s.jsxs(l.motion.div,e.__assign({initial:{width:Oe?"345px":"43px"},animate:{width:Oe?"345px":"43px"},transition:{duration:.3},style:_.styles.mrCalendarPanel},{children:[Oe?s.jsx(u.default,{assignees:y}):s.jsx("div",e.__assign({style:_.styles.mrCalendarCollapsed},{children:s.jsx(n.CalendarIcon,{style:_.styles.mrIconCalendar})})),s.jsxs("button",e.__assign({onClick:function(){return Ye(function(e){return!e})},style:_.styles.mrCalendarToggle},{children:[s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50",fill:"none"},{children:s.jsx("path",{d:"M3.94434 9.65137C1.79601 11.031 0.49707 13.4087 0.49707 15.9619V35.1436C0.49707 37.8496 1.95476 40.346 4.31152 41.6758L17.5469 49.1426V0.915039L3.94434 9.65137Z",fill:"white",stroke:"#E0E0E0"})})),Oe?s.jsx(n.ChevronRight,{style:_.styles.mrIconChevronToggle}):s.jsx(n.ChevronLeft,{style:_.styles.mrIconChevronToggle})]}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=ManageReminders.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),n=require("../styles/AssignLevelsDatePickerStyles.js"),a=function(e){if(e){var t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(n)}};exports.default=function(i){var l,s=i.value,u=i.onSet,o=i.minDate,c=i.maxDate,d=i.disabled,_=void 0!==d&&d,v=r.useRef(null),p=a(null!=o?o:new Date),S=a(c);return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},n.DATE_PICKER_STYLES.wrapper),{cursor:_?"not-allowed":n.DATE_PICKER_STYLES.wrapper.cursor,opacity:_?.65:1}),onClick:function(){var e,t;_||null===(t=null===(e=v.current)||void 0===e?void 0:e.showPicker)||void 0===t||t.call(e)}},{children:[t.jsx("span",e.__assign({style:n.DATE_PICKER_STYLES.placeholder},{children:s?s.toLocaleDateString("en-GB"):"--/--/----"})),t.jsx("input",{ref:v,type:"date",max:S,min:p,style:n.DATE_PICKER_STYLES.input,value:null!==(l=a(s))&&void 0!==l?l:"",disabled:_,onChange:function(e){if(!_){var t=e.target.value;u(t?function(e){var t=e.split("-").map(Number),r=t[0],n=t[1],a=t[2];return r&&n&&a?new Date(r,n-1,a,12,0,0,0):null}(t):null)}}})]}))};
|
|
2
2
|
//# sourceMappingURL=AssignLevelsDatePicker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("lucide-react");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(n);exports.default=function(a){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("lucide-react");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(n),o=function(e){var t=e.split("-"),n=t[0],r=t[1],a=t[2];return n&&r&&a?"".concat(a,"/").concat(r,"/").concat(n):e};exports.default=function(a){var l=a.value,u=a.onChange,s=a.placeholder,c=void 0===s?"dd/mm/yyyy":s,d=a.disabled,p=void 0!==d&&d,g=a.minDate,v=n.useRef(null),f=i.default.useMemo(function(){var e=null!=g?g:new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},[g]);return t.jsxs("div",e.__assign({onClick:function(){var e,t;p||null===(t=null===(e=v.current)||void 0===e?void 0:e.showPicker)||void 0===t||t.call(e)},style:{position:"relative",width:"100%",height:"35px",padding:"0 12px",borderRadius:"12px",background:"#F3F4F6",border:"1px solid #C7CDD5",display:"flex",gap:60,alignItems:"center",cursor:p?"not-allowed":"pointer",opacity:p?.65:1,boxSizing:"border-box"}},{children:[t.jsx("input",{ref:v,type:"date",value:l,onChange:function(e){return u(e.target.value?function(e){var t=e.split("-").map(Number),n=t[0],r=t[1],a=t[2];return n&&r&&a?new Date(n,r-1,a,12,0,0,0):null}(e.target.value):null)},min:f,disabled:p,style:{position:"absolute",opacity:0,pointerEvents:"none"}}),t.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:400,color:l?"#111827":"#667085"}},{children:l?o(l):c})),t.jsx("div",e.__assign({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"6px"}},{children:t.jsx(r.Calendar,{size:18,color:"#667085",strokeWidth:2})}))]}))};
|
|
2
2
|
//# sourceMappingURL=CustomDatePicker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react"),l=require("../styles/ReviewStatusStyles.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(n),r=function(e){var s=e.trim().split(/\s+/);return 1===s.length?s[0].slice(0,2).toUpperCase():(s[0][0]+s[s.length-1][0]).toUpperCase()},a=function(e){for(var s=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],n=0,i=0;i<e.length;i++)n=e.charCodeAt(i)+((n<<5)-n);return s[Math.abs(n)%s.length]},d=function(e){var s=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof s&&s.trim()?s:"No role assigned"},p=function(e){return!0===e||("string"==typeof e?["approved","completed","complete","done","accepted"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(p(e.approved)||p(e.status)||p(e.action)||p(e.value)))},c=function(e){return"string"==typeof e?["rejected","declined","denied"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(c(e.rejected)||c(e.status)||c(e.action)||c(e.value))};function g(n){var l,t=n.reviewLevel,o=n.levelIndex,r=n.nextLevel,a=n.showApproveAndMoveToNextLevelButton,d=n.onApproveAndMoveToNextLevel,p=t.level,c=t.assigneeStatuses,g=t.extendedStatus,x=a&&"pending"===g&&!!d,_=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[g])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},f="approved"===g?"1px solid #D1FAE5":"rejected"===g?"1px solid #FCA5A5":"optional"===g?"1px dashed #CBD5E1":"1px solid #E5E7EB",h="approved"===g?"#F0FDF4":"rejected"===g?"#FEF2F2":"#F8FAFC";return!p.assignees||!Array.isArray(p.assignees)||p.assignees.length<1?null:s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:f,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:h,borderBottom:f,padding:"12px 16px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:10}},{children:[s.jsx(v,{name:p.headerName}),s.jsx("span",e.__assign({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:p.title}))]})),s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[x&&s.jsxs("button",e.__assign({type:"button",onClick:function(){return null==d?void 0:d({level:p,levelIndex:o,nextLevel:r})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx(i.Check,{size:13}),"Approve & Move to Next Level"]})),s.jsxs("div",e.__assign({style:{backgroundColor:_.bg,color:_.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[_.icon,_.text]}))]}))]})),s.jsx("div",e.__assign({style:{padding:"16px"}},{children:c.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:16}},{children:c.map(function(e,n){var i;return s.jsx(u,{assigneeStatus:e,extendedStatus:g},null!==(i=e.user.id)&&void 0!==i?i:n)})})):s.jsx("div",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function x(n){var l,t,o,p,c=n.reviewLevel,g=c.assigneeStatuses,x=c.extendedStatus,u=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[x])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},v=null===(t=g[0])||void 0===t?void 0:t.user;null==v||v.email;var _=d(v);return s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[v?s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:a(null!==(o=v.id)&&void 0!==o?o:v.name).bg,color:a(null!==(p=v.id)&&void 0!==p?p:v.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:r(v.name)})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:v.name})),s.jsxs("span",e.__assign({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",_]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):s.jsx("span",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),s.jsxs("div",e.__assign({style:{backgroundColor:u.bg,color:u.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[u.icon,u.text]}))]}))}function u(n){var l,t=n.assigneeStatus,o=n.extendedStatus,p=t.user,c=t.approved||"approved"===p.action,g=t.rejected||"rejected"===p.action,x=r(p.name),u=a(null!==(l=p.id)&&void 0!==l?l:p.name),v=d(p);return s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:u.bg,color:u.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:x})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:p.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:v}))]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:p.email}))]}))]})),s.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:c?s.jsx(i.CircleCheck,{size:20,color:"#16A34A",strokeWidth:1.5}):g?s.jsx(i.X,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===o?s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{fontSize:"13px",color:"#4B5563"}}),s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):"optional"===o?s.jsx(i.MinusCircle,{size:20,color:"#CBD5E1",strokeWidth:1.5}):s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function v(n){var i=n.name,l=a(i);return s.jsx("span",e.__assign({style:{backgroundColor:l.bg,color:l.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:i}))}var _=function(e){switch(e){case 0:return s.jsx(i.LucidePen,{size:16,color:"#475569"});case 1:return s.jsx(i.FileCheck,{size:16,color:"#475569"});case 2:return s.jsx(i.User,{size:16,color:"#475569"});default:return s.jsx(i.CheckCircle,{size:16,color:"#475569"})}};function f(n){var t=n.levels.filter(function(e){var s,n;return(null!==(n=null===(s=e.assignees)||void 0===s?void 0:s.length)&&void 0!==n?n:0)>0});return s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowBox},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowTitle},{children:"Current Approval Flow"})),t.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:t.map(function(n,r){var a,p=n.isHidden,c=!n.isMandatory&&!p,g=p?s.jsx(i.User,{size:16,color:"#475569"}):_(r);return s.jsxs(o.default.Fragment,{children:[s.jsxs("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:c?"1px dashed #CBD5E1":void 0})},{children:[g,s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[n.assignees.map(function(n,i){var l,t,r=d(n);return s.jsxs(o.default.Fragment,{children:[i>0&&s.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:13,color:c?"#64748B":"#374151"}},{children:n.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:r}))]}))]},null!==(t=null!==(l=n.id)&&void 0!==l?l:n.email)&&void 0!==t?t:i)}),c&&s.jsx("span",e.__assign({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<t.length-1&&s.jsx(i.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(a=n.id)&&void 0!==a?a:"".concat(n.headerName,"-").concat(r))})})):s.jsx("p",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowEmpty},{children:"No owners assigned yet."}))]}))}exports.default=function(n){var t=n.levels,r=n.reviewData,a=void 0===r?{}:r,d=n.showApproveAndMoveToNextLevelButton,u=void 0!==d&&d,v=n.onApproveAndMoveToNextLevel,_=t.map(function(e,s){var n,i,l,t,o,r,d,g,x=null!==(d=null!==(l=null!==(i=null!==(n=a[s])&&void 0!==n?n:a[e.headerName])&&void 0!==i?i:a[e.title])&&void 0!==l?l:e.isHidden?null!==(r=null!==(o=null!==(t=a.final)&&void 0!==t?t:a.Final)&&void 0!==o?o:a.finalApproval)&&void 0!==r?r:a.final_approval:void 0)&&void 0!==d?d:{},u=x&&"object"==typeof x?x:{},v=(null!==(g=e.assignees)&&void 0!==g?g:[]).map(function(s){var n,i,l,t,o,r,a=null!==(i=null!==(n=u[String(s.id)])&&void 0!==n?n:u[String(s.email)])&&void 0!==i?i:e.isHidden?null!==(r=null!==(o=null!==(t=null!==(l=u.owner)&&void 0!==l?l:u.final)&&void 0!==t?t:u.finalApproval)&&void 0!==o?o:u.final_approval)&&void 0!==r?r:x:void 0;return{user:s,approved:p(a)||p(s.action)||p(s.status)||p(s.approved)||p(s.isApproved),rejected:c(a)||c(s.action)||c(s.status)||c(s.rejected)||c(s.isRejected)}}),_="not_started";if(p(x)||p(e.isApproved)||p(e.approved))_="approved";else if(c(x)||c(e.isRejected)||c(e.rejected))_="rejected";else if(p(e.status))_="approved";else if(c(e.status))_="rejected";else{var f=v.length>0&&v.every(function(e){return e.approved}),h=v.some(function(e){return e.rejected});f?_="approved":h&&(_="rejected")}return{level:e,assigneeStatuses:v,status:_}}),h=!1,j=_.map(function(s){var n="waiting",i=!0===s.level.isHidden;return"approved"===s.status?n="approved":"rejected"===s.status?(n="rejected",h=!0):s.level.isMandatory||i?h||(n="pending",h=!0):n="optional",e.__assign(e.__assign({},s),{extendedStatus:n,isFinalApproval:i})}),F=function(e){return e.filter(function(e){return"approved"===e.status}).length}(_),y=_.length;return s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:24}},{children:[s.jsxs("div",{children:[s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressHeader},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressTitle},{children:"Approval Progress"})),s.jsxs("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressCount},{children:[F," of ",y," level",1!==y?"s":""," complete"]}))]})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressBarTrack},{children:j.map(function(n,i){var t,o="approved"===n.extendedStatus,r="rejected"===n.extendedStatus,a="optional"===n.extendedStatus,d=0===i,p=i===y-1;return!(null===(t=n.level)||void 0===t?void 0:t.assignees)||!Array.isArray(n.level.assignees)||n.level.assignees.length<1?null:s.jsx("div",{style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressSegment),{backgroundColor:o?"#6366F1":r?"#EF4444":a?"#F1F5F9":"#E5E7EB",borderRadius:d&&p?"999px":d?"999px 0 0 999px":p?"0 999px 999px 0":"0",marginRight:p?0:3})},i)})})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressLabels},{children:j.map(function(n,i){return s.jsx("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressLabel),{color:"approved"===n.extendedStatus?"#6366F1":"rejected"===n.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===n.extendedStatus||"rejected"===n.extendedStatus?600:400})},{children:n.level.assignees&&n.level.assignees.length>0?"".concat(n.level.headerName," - ").concat(n.level.title):""}),i)})}))]}),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:0}},{children:[s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionHeadingRow},{children:s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:6}},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionTitle},{children:"Approval Levels"})),s.jsx(i.Info,{size:15,color:"#9CA3AF"})]}))})),s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:j.map(function(n,i){var l,t,r=i===j.length-1,a=n.isFinalApproval,d=j[i+1],p=null==d?void 0:d.isFinalApproval,c=d&&!d.level.isMandatory&&!p;return a?s.jsxs(o.default.Fragment,{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),s.jsx("div",e.__assign({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),s.jsx(x,{reviewLevel:n})]},i):s.jsxs(o.default.Fragment,{children:[s.jsx(g,{reviewLevel:n,levelIndex:i,nextLevel:null!==(l=null==d?void 0:d.level)&&void 0!==l?l:null,showApproveAndMoveToNextLevelButton:u,onApproveAndMoveToNextLevel:v}),!r&&!p&&d.level.assignees&&(null===(t=d.level.assignees)||void 0===t?void 0:t.length)>0&&s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:c?"optional":"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},i)})}))]})),s.jsx(f,{levels:t})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react"),l=require("../styles/ReviewStatusStyles.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(n),r=function(e){var s=e.trim().split(/\s+/);return 1===s.length?s[0].slice(0,2).toUpperCase():(s[0][0]+s[s.length-1][0]).toUpperCase()},a=function(e){for(var s=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],n=0,i=0;i<e.length;i++)n=e.charCodeAt(i)+((n<<5)-n);return s[Math.abs(n)%s.length]},d=function(e){var s=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof s&&s.trim()?s:"No role assigned"},p=function(e){return!0===e||("string"==typeof e?["approved","completed","complete","done","accepted"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(p(e.approved)||p(e.status)||p(e.action)||p(e.value)))},c=function(e){return"string"==typeof e?["rejected","declined","denied"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(c(e.rejected)||c(e.status)||c(e.action)||c(e.value))};function g(n){var l,t=n.reviewLevel,o=n.levelIndex,r=n.nextLevel,a=n.showApproveAndMoveToNextLevelButton,d=n.onApproveAndMoveToNextLevel,p=t.level,c=t.assigneeStatuses,g=t.extendedStatus,x=a&&"pending"===g&&!!d,_=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[g])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},f="approved"===g?"1px solid #D1FAE5":"rejected"===g?"1px solid #FCA5A5":"optional"===g?"1px dashed #CBD5E1":"1px solid #E5E7EB",h="approved"===g?"#F0FDF4":"rejected"===g?"#FEF2F2":"#F8FAFC";return!p.assignees||!Array.isArray(p.assignees)||p.assignees.length<1?null:s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:f,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:h,borderBottom:f,padding:"12px 16px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:10}},{children:[s.jsx(v,{name:p.headerName}),s.jsx("span",e.__assign({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:p.title}))]})),s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[x&&s.jsxs("button",e.__assign({type:"button",onClick:function(){return null==d?void 0:d({level:p,levelIndex:o,nextLevel:r})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx(i.Check,{size:13}),"Approve & Move to Next Level"]})),s.jsxs("div",e.__assign({style:{backgroundColor:_.bg,color:_.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[_.icon,_.text]}))]}))]})),s.jsx("div",e.__assign({style:{padding:"16px"}},{children:c.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:16}},{children:c.map(function(e,n){var i;return s.jsx(u,{assigneeStatus:e,extendedStatus:g},null!==(i=e.user.id)&&void 0!==i?i:n)})})):s.jsx("div",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function x(n){var l,t,o,p,c=n.reviewLevel,g=c.assigneeStatuses,x=c.extendedStatus,u=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[x])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},v=null===(t=g[0])||void 0===t?void 0:t.user;null==v||v.email;var _=d(v);return s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[v?s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:a(null!==(o=v.id)&&void 0!==o?o:v.name).bg,color:a(null!==(p=v.id)&&void 0!==p?p:v.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:r(v.name)})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:v.name})),s.jsxs("span",e.__assign({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",_]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):s.jsx("span",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),s.jsxs("div",e.__assign({style:{backgroundColor:u.bg,color:u.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[u.icon,u.text]}))]}))}function u(n){var l,t=n.assigneeStatus,o=n.extendedStatus,p=t.user,c=t.approved||"approved"===p.action,g=t.rejected||"rejected"===p.action,x=r(p.name),u=a(null!==(l=p.id)&&void 0!==l?l:p.name),v=d(p);return s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:u.bg,color:u.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:x})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:p.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:v}))]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:p.email}))]}))]})),s.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:c?s.jsx(i.CircleCheck,{size:20,color:"#16A34A",strokeWidth:1.5}):g?s.jsx(i.X,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===o?s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{fontSize:"13px",color:"#4B5563"}}),s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):"optional"===o?s.jsx(i.MinusCircle,{size:20,color:"#CBD5E1",strokeWidth:1.5}):s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function v(n){var i=n.name,l=a(i);return s.jsx("span",e.__assign({style:{backgroundColor:l.bg,color:l.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:i}))}var _=function(e){switch(e){case 0:return s.jsx(i.LucidePen,{size:16,color:"#475569"});case 1:return s.jsx(i.FileCheck,{size:16,color:"#475569"});case 2:return s.jsx(i.User,{size:16,color:"#475569"});default:return s.jsx(i.CheckCircle,{size:16,color:"#475569"})}};function f(n){var t=n.levels.filter(function(e){var s,n;return(null!==(n=null===(s=e.assignees)||void 0===s?void 0:s.length)&&void 0!==n?n:0)>0});return s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowBox},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowTitle},{children:"Current Approval Flow"})),t.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:t.map(function(n,r){var a,p=n.isHidden,c=!n.isMandatory&&!p,g=p?s.jsx(i.User,{size:16,color:"#475569"}):_(r);return s.jsxs(o.default.Fragment,{children:[s.jsxs("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:c?"1px dashed #CBD5E1":void 0})},{children:[g,s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[n.assignees.map(function(n,i){var l,t,r=d(n);return s.jsxs(o.default.Fragment,{children:[i>0&&s.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:13,color:c?"#64748B":"#374151"}},{children:n.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:r}))]}))]},null!==(t=null!==(l=n.id)&&void 0!==l?l:n.email)&&void 0!==t?t:i)}),c&&s.jsx("span",e.__assign({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<t.length-1&&s.jsx(i.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(a=n.id)&&void 0!==a?a:"".concat(n.headerName,"-").concat(r))})})):s.jsx("p",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowEmpty},{children:"No owners assigned yet."}))]}))}exports.default=function(n){var t=n.levels,r=n.reviewData,a=void 0===r?{}:r,d=n.showApproveAndMoveToNextLevelButton,u=void 0!==d&&d,v=n.onApproveAndMoveToNextLevel,_=t.map(function(e,s){return{level:e,originalLevelIndex:s}}).filter(function(e){return function(e){var s=null==e?void 0:e.assignees;return Array.isArray(s)&&s.length>0}(e.level)}).map(function(e,s){var n,i,l,t,o,r,d,g,x,u=e.level,v=e.originalLevelIndex,_=null!==(g=null!==(t=null!==(l=null!==(i=null!==(n=a[v])&&void 0!==n?n:a[s])&&void 0!==i?i:a[u.headerName])&&void 0!==l?l:a[u.title])&&void 0!==t?t:u.isHidden?null!==(d=null!==(r=null!==(o=a.final)&&void 0!==o?o:a.Final)&&void 0!==r?r:a.finalApproval)&&void 0!==d?d:a.final_approval:void 0)&&void 0!==g?g:{},f=_&&"object"==typeof _?_:{},h=(null!==(x=u.assignees)&&void 0!==x?x:[]).map(function(e){var s,n,i,l,t,o,r=null!==(n=null!==(s=f[String(e.id)])&&void 0!==s?s:f[String(e.email)])&&void 0!==n?n:u.isHidden?null!==(o=null!==(t=null!==(l=null!==(i=f.owner)&&void 0!==i?i:f.final)&&void 0!==l?l:f.finalApproval)&&void 0!==t?t:f.final_approval)&&void 0!==o?o:_:void 0;return{user:e,approved:p(r)||p(e.action)||p(e.status)||p(e.approved)||p(e.isApproved),rejected:c(r)||c(e.action)||c(e.status)||c(e.rejected)||c(e.isRejected)}}),j="not_started";if(p(_)||p(u.isApproved)||p(u.approved))j="approved";else if(c(_)||c(u.isRejected)||c(u.rejected))j="rejected";else if(p(u.status))j="approved";else if(c(u.status))j="rejected";else{var F=h.length>0&&h.every(function(e){return e.approved}),y=h.some(function(e){return e.rejected});F?j="approved":y&&(j="rejected")}return{level:u,assigneeStatuses:h,status:j,originalLevelIndex:v}}),h=!1,j=_.map(function(s){var n="waiting",i=!0===s.level.isHidden;return"approved"===s.status?n="approved":"rejected"===s.status?(n="rejected",h=!0):s.level.isMandatory||i?h||(n="pending",h=!0):n="optional",e.__assign(e.__assign({},s),{extendedStatus:n,isFinalApproval:i})}),F=function(e){return e.filter(function(e){return"approved"===e.status}).length}(_),y=_.length;return s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:24}},{children:[s.jsxs("div",{children:[s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressHeader},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressTitle},{children:"Approval Progress"})),s.jsxs("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressCount},{children:[F," of ",y," level",1!==y?"s":""," complete"]}))]})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressBarTrack},{children:j.map(function(n,i){var t="approved"===n.extendedStatus,o="rejected"===n.extendedStatus,r="optional"===n.extendedStatus,a=0===i,d=i===y-1;return s.jsx("div",{style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressSegment),{backgroundColor:t?"#6366F1":o?"#EF4444":r?"#F1F5F9":"#E5E7EB",borderRadius:a&&d?"999px":a?"999px 0 0 999px":d?"0 999px 999px 0":"0",marginRight:d?0:3})},i)})})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressLabels},{children:j.map(function(n,i){return s.jsx("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressLabel),{color:"approved"===n.extendedStatus?"#6366F1":"rejected"===n.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===n.extendedStatus||"rejected"===n.extendedStatus?600:400})},{children:n.level.assignees&&n.level.assignees.length>0?"".concat(n.level.headerName," - ").concat(n.level.title):""}),i)})}))]}),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:0}},{children:[s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionHeadingRow},{children:s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:6}},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionTitle},{children:"Approval Levels"})),s.jsx(i.Info,{size:15,color:"#9CA3AF"})]}))})),s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:j.map(function(n,i){var l,t,r=i===j.length-1,a=n.isFinalApproval,d=j[i+1],p=null==d?void 0:d.isFinalApproval,c=d&&!d.level.isMandatory&&!p;return a?s.jsxs(o.default.Fragment,{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),s.jsx("div",e.__assign({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),s.jsx(x,{reviewLevel:n})]},i):s.jsxs(o.default.Fragment,{children:[s.jsx(g,{reviewLevel:n,levelIndex:n.originalLevelIndex,nextLevel:null!==(l=null==d?void 0:d.level)&&void 0!==l?l:null,showApproveAndMoveToNextLevelButton:u,onApproveAndMoveToNextLevel:v}),!r&&!p&&d.level.assignees&&(null===(t=d.level.assignees)||void 0===t?void 0:t.length)>0&&s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:c?"optional":"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},i)})}))]})),s.jsx(f,{levels:t})]}))};
|
|
2
2
|
//# sourceMappingURL=ReviewStatus.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(e){var t=new Date(e);return t.setHours(0,0,0,0),t},t=function(t){if(!t.dueDate)return null;var r=new Date(t.dueDate);return Number.isFinite(r.getTime())?e(r):null};exports.getApprovalDateValidationError=function(r,n){var a=r.filter(function(e){return!e.isHidden}),u=e(new Date),o=n?new Date(n):null;if(o&&!Number.isFinite(o.getTime()))return"Final approval has an invalid due date";var i=o?e(o):null;if(i&&i<u)return"Final approval due date cannot be before today";for(var l=null,d=0,c=0;c<a.length;c+=1){var f=a[c];if(f.dueDate){var v=t(f);if(!v)return"Level ".concat(c+1," has an invalid due date");if(v<u)return"Level ".concat(c+1," due date cannot be before today");if(l&&v<l)return"Level ".concat(c+1," due date cannot be before Level ").concat(d," due date");if(i&&v>i)return"Level ".concat(c+1," due date cannot be after final approval due date");l=v,d=c+1}}return null},exports.getEarliestLevelDueDate=function(e){return e.reduce(function(e,r){var n=t(r);return!n||e&&n>=e?e:n},null)},exports.getLatestLevelDueDate=function(e){return e.reduce(function(e,r){var n=t(r);return!n||e&&n<=e?e:n},null)},exports.normalizeApprovalDate=function(e){var t=new Date(e);return t.setHours(12,0,0,0),t},exports.startOfCalendarDay=e;
|
|
2
|
+
//# sourceMappingURL=approvalDateValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvalDateValidation.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../_virtual/_tslib.js";import{jsx as n,jsxs as i}from"react/jsx-runtime";import l from"react";import{PenLine as t,UserRoundCheck as r,Bell as o,InfoIcon as a,User as s,ArrowRight as d,CheckSquare as u,FileCheck as c,Edit2 as p}from"lucide-react";import
|
|
1
|
+
import{__assign as e}from"../../_virtual/_tslib.js";import{jsx as n,jsxs as i}from"react/jsx-runtime";import l from"react";import{PenLine as t,UserRoundCheck as r,Bell as o,InfoIcon as a,User as s,ArrowRight as d,CheckSquare as u,FileCheck as c,Edit2 as p}from"lucide-react";import f from"./AssignLevelAccordions.js";import v from"./components/CustomCheckbox.js";import m from"./assets/FileCheckCorner.js";import{DEFAULT_ASSIGN_REMINDER_STYLES as g}from"./styles/AssignReminderStyles.js";import{getLatestLevelDueDate as h,getEarliestLevelDueDate as y,startOfCalendarDay as x,normalizeApprovalDate as A}from"./utils/approvalDateValidation.js";var b=[{label:"Edit & Approve",icon:n(m,{})},{label:"Edit",icon:n(t,{size:14})},{label:"Approve",icon:n(r,{size:14})},{label:"Notify",icon:n(o,{size:14})}],D=function(){return x(new Date)},L=function(e,n){var i=h(e.slice(0,n));return i&&i>D()?i:D()},F=function(e,n,i){var l=y(e.slice(n+1)),t=i?x(i):null;return l?t?l<t?l:t:l:t};function w(t){var r=t.title,o=t.levels,m=void 0===o?[]:o,h=t.requireFinalApproval,y=void 0!==h&&h,D=t.additionalInfo,w=t.setLevels,C=t.setRequireFinalApproval,z=t.fetchUsers,M=t.accessLevelOptions,I=void 0===M?b:M,W=t.customInfoIcon,E=t.onValidationError,H=t.customStyles,S=void 0===H?{}:H,j=t.totalLevels,q=t.finalApprovalDueDate,R=t.displayConfig,T=l.useState(!1),B=T[0],k=T[1],O=!!(null==R?void 0:R.disableRequiredButtonOnUserAdd),V=function(e){return(null!=e?e:[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)||!!(null==e?void 0:e.name)})};l.useEffect(function(){O&&(null==w||w(function(n){var i=!1,l=n.map(function(n){var l,t,r=(null!==(t=null===(l=n.assignees)||void 0===l?void 0:l.length)&&void 0!==t?t:0)>0;return n.isHidden||n.isMandatory||!r?n:(i=!0,e(e({},n),{isMandatory:!0}))});return i?l:n}))},[m,w,O]);var N,U=l.useMemo(function(){return Array.from({length:null!=j?j:3},function(e,n){var i;return null!==(i=m[n])&&void 0!==i?i:{title:"Level ".concat(n+1),headerName:"L ".concat(n+1),isMandatory:!1,dueDate:null,assignees:[],hasDueDate:!0}})},[m,j]),_=(m.length>0?m:U).filter(function(e){return!e.isHidden});return i("div",e({style:e({padding:"8px",display:"flex",flexDirection:"column",gap:"18px"},S.container)},{children:[i("span",e({style:e(e({},g.header),S.levelsHeader)},{children:[n("span",{children:null!=r?r:"Assignee Levels"}),i("div",e({style:e(e({},g.infoIconWrapper),S.infoIconWrapper),onMouseEnter:function(){return k(!0)},onMouseLeave:function(){return k(!1)}},{children:[null!=W?W:n(a,{width:18,height:18}),n("div",e({style:e(e(e({},g.tooltip),S.tooltip),B?e(e({},g.tooltipVisible),S.tooltipVisible):{})},{children:D||i("span",{children:[n("b",{children:"How it works:"}),n("br",{}),"Level 1 is required by default, Enable Level 2 and Level 3 to add sequential approval steps for the review"]})}))]}))]})),n("div",e({style:e({display:"flex",flexDirection:"column",gap:"16px"},S.accordionsContainer)},{children:_.map(function(i,l){return n(f,{level:O&&V(i.assignees)?e(e({},i),{isMandatory:!0}):i,id:String(l),accessLevelOptions:I,fetchUsers:z,onToggleMandatory:function(){return function(n){var i,l,t,r=(null!==(t=null===(l=null===(i=m[n])||void 0===i?void 0:i.assignees)||void 0===l?void 0:l.length)&&void 0!==t?t:0)>0;O&&r||null==w||w(function(i){return i.map(function(i,l){return l===n?e(e({},i),{isMandatory:!i.isMandatory}):i})})}(l)},onDueDateChange:function(n){return function(n,i){if(i){var l=x(i),t=m.filter(function(e){return!e.isHidden}),r=L(t,n),o=F(t,n,q);if(l<r)return void(null==E||E(0===n?"Level 1 due date cannot be before today":"Level ".concat(n+1," due date cannot be before Level ").concat(n," due date")));if(o&&l>o){var a=t.slice(n+1).some(function(e){return!!e.dueDate});return void(null==E||E(a?"Level ".concat(n+1," due date cannot be after a later level due date"):"Level due date cannot be after final approval due date"))}}null==w||w(function(l){return l.map(function(t,r){return t.isHidden?t:l.slice(0,r).filter(function(e){return!e.isHidden}).length===n?e(e({},t),{dueDate:i?A(i):null}):t})})}(l,n)},onAssigneesChange:function(n){return i=l,r=(null!=(t=n)?t:[]).map(function(n){var i=n.accessLevel||n.role||"";return e(e({},n),{role:i,accessLevel:i})}),o=O&&V(r),void(null==w||w(function(n){return n.map(function(n,l){return l===i?e(e({},n),{assignees:r,isMandatory:!!o||n.isMandatory}):n})}));var i,t,r,o},onTitleChange:function(n){return function(n,i){null==w||w(function(l){return l.map(function(l,t){return t===n?e(e({},l),{title:i}):l})})}(l,n)},minDueDate:L(_,l),maxDueDate:F(_,l,q),finalApprovalDueDate:q,displayConfig:R},l)})})),i("div",e({style:e(e({},g.finalApprovalBox),S.finalApprovalBox)},{children:[n(v,{getter:y,setter:null!=C?C:function(){}}),i("div",e({style:e({display:"flex",flexDirection:"column",alignItems:"baseline",fontSize:"14px",fontWeight:400},S.finalApprovalTextWrapper)},{children:[n("span",e({style:e({fontWeight:500},S.finalApprovalTitle)},{children:"Require Final Approval"})),n("span",e({style:S.finalApprovalDesc},{children:"After all assignees approve, you (the owner) will be notified to give final sign-off before the redline is settled."}))]}))]})),i("div",e({style:e(e({},g.currentApprovalFlow),S.currentApprovalFlow)},{children:[n("span",e({style:e({fontSize:"14px",fontWeight:600},S.currentApprovalFlowTitle)},{children:"Current Approval Flow"})),(N=m.filter(function(e){var n,i;return(null!==(i=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0}),n("div",e({style:e({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"4px"},S.approvalFlowItemsWrapper)},{children:N.map(function(t,r){var o,a,f=t.isHidden,v=!t.isMandatory&&!f,m=null!==(o=t.assignees)&&void 0!==o?o:[],g=f?n(s,{size:16}):function(e){switch(e){case 0:return n(p,{size:16});case 1:return n(c,{size:16});case 2:return n(s,{size:16});default:return n(u,{size:16})}}(r);return i(l.Fragment,{children:[i("div",e({style:e({display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",fontWeight:500,color:v?"#64748B":"#374151",border:v?"1px dashed #CBD5E1":void 0,borderRadius:v?"6px":void 0,padding:v?"2px 6px":void 0},S.approvalFlowItem),title:t.title||"Level ".concat(r+1)},{children:[g,i("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[m.map(function(t,r){var o,a,s=t.role||t.accessLevel||"No role assigned";return i(l.Fragment,{children:[r>0&&n("span",e({style:{color:"#9CA3AF"}},{children:"/"})),i("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n("span",{children:t.name}),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:s}))]}))]},null!==(a=null!==(o=t.id)&&void 0!==o?o:t.email)&&void 0!==a?a:r)}),v&&n("span",{children:"(Optional)"})]}))]})),r<N.length-1&&n(d,{size:16,color:"#9CA3AF"})]},null!==(a=t.id)&&void 0!==a?a:r)})})))]}))]}))}export{w as AssignReminderLevels};
|
|
2
2
|
//# sourceMappingURL=AssignReminderLevels.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as r,Fragment as t}from"react/jsx-runtime";import{Bell as a,ClipboardList as o,X as l,CircleAlert as s}from"lucide-react";import d,{useState as u,useEffect as c}from"react";import{AssignReminderLevels as v}from"./AssignReminderLevels.js";import m from"./components/ReviewStatus.js";import f from"./components/CustomDatePicker.js";import{ManageReminders as p}from"./ManageReminders.js";import{DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES as y}from"./styles/AssignReminderWrapperStyles.js";var h=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],b=[{tabName:"Assignees & Approvers",tabIcon:i("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[r("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),r("circle",{cx:"9",cy:"7",r:"4"}),r("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),r("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:r(a,{size:15})},{tabName:"Review Status",tabIcon:r(o,{size:15})}],D=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function g(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}var w=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e(e({},n),{isMandatory:!0,hasDueDate:!0})})},A=function(n){return n.map(function(n){var i;return e(e({},n),{assignees:(null!==(i=n.assignees)&&void 0!==i?i:[]).map(function(n){var i=n.accessLevel||n.role||"";return e(e({},n),{role:i,accessLevel:i})})})})},L=function(e,i){void 0===e&&(e=h),void 0===i&&(i=[]);var r=e.find(function(e){return e.isHidden}),t=i.find(function(e){return e.isHidden}),a=e.filter(function(e){return!e.isHidden}),o=r||t,l=o?n(n([],a,!0),[o],!1):a;return A(w(l))},_=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();return Number.isFinite(i)?n.toISOString():""},R=function(e){return void 0===e&&(e=[]),JSON.stringify(e.map(function(e){var n,i,r,t;return{headerName:null!==(n=e.headerName)&&void 0!==n?n:"",title:null!==(i=e.title)&&void 0!==i?i:"",isMandatory:!!e.isMandatory,hasDueDate:!!e.hasDueDate,isHidden:!!e.isHidden,dueDate:_(e.dueDate),status:null!==(r=e.status)&&void 0!==r?r:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(t=e.assignees)&&void 0!==t?t:[]).map(function(e){var n,i,r,t,a,o,l,s,d,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(r=e.email)&&void 0!==r?r:"",accessLevel:null!==(a=null!==(t=e.accessLevel)&&void 0!==t?t:e.role)&&void 0!==a?a:"",role:null!==(l=null!==(o=e.role)&&void 0!==o?o:e.accessLevel)&&void 0!==l?l:"",notes:null!==(s=e.notes)&&void 0!==s?s:"",sendMailNow:!!e.sendMailNow,action:null!==(d=e.action)&&void 0!==d?d:"",action_taken_at:null!==(u=e.action_taken_at)&&void 0!==u?u:""}})}}))},S=function(e){return _(e)},T=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return"username (you)"===n||"username"===n},C=function(e,n){return T(null==e?void 0:e.name)?T(null==n?void 0:n.name)?(null==e?void 0:e.email)||(null==n?void 0:n.email)||"Owner":n.name:e.name};function N(a){var o,_,T=a.metadata,N=void 0===T?{}:T,q=a.reviewData,B=void 0===q?{}:q,M=a.levels,F=a.setLevels,x=a.requireFinalApproval,O=a.setRequireFinalApproval,k=a.approvalDueDate,H=a.setApprovalDueDate,j=a.onClose,I=a.fetchUsers,P=a.onSave,E=a.onValidationError,W=a.showApproveAndMoveToNextLevelButton,z=a.onApproveAndMoveToNextLevel,U=a.totalLevels,V=a.customStyles,J=void 0===V?{}:V,G=a.isSaving,K=void 0!==G&&G,Q=a.displayConfig,X=void 0===Q?{}:Q,Y=a.onRequireFinalApproval,Z=a.isOwner,$=void 0===Z||Z,ee=a.blockEditScreen,ne=void 0!==ee&&ee,ie=a.hideManageReminders,re=void 0!==ie&&ie,te=a.hideClearButton,ae=void 0!==te&&te,oe=a.hideSaveChangesButton,le=void 0!==oe&&oe,se=a.hideFooterActions,de=void 0!==se&&se;a.hideAssigneeApproverScreen,a.remindersData;var ue=a.remainderOwners,ce=a.setRemainderOwners,ve=a.schedules,me=a.setSchedules,fe=a.handelSendNow,pe=a.showPreviewEmail,ye=a.tabName,he=a.reminderLabels,be=a.reminderColors,De=a.reminderChipColor,ge=a.reminderAssignees,we=a.reminderFallbackRecipients,Ae=a.reminderRecipientsColor,Le=a.manualReminderTitle,_e=a.manualReminderDescription,Re=a.lastReminderText,Se=a.selectRecipientsLabel,Te=a.previewEmailButtonLabel,Ce=a.sendNowButtonLabel,Ne=a.reminderSuccessTitle,qe=a.reminderSuccessDescription,Be=a.escalationTitle,Me=a.escalationTitleTooltip,Fe=a.escalationDescription,xe=a.configureAutoReminderText,Oe=a.getDynamicStatement,ke=a.reminderStartDateLabel,He=a.documentDueDateLabel,je=a.reminderFrequencyLabel,Ie=a.escalationRemindersLabel,Pe=a.escalationTooltip,Ee=a.escalationConditionText,We=a.daysText,ze=a.dueDataAndRepeatText,Ue=a.reminderFrequencyOptions,Ve=a.escalationFrequencyOptions,Je=a.beforeAfterOptions,Ge=d.useMemo(function(){var e;return(null===(e=N.tabData)||void 0===e?void 0:e.length)?N.tabData:b},[N.tabData]),Ke=d.useMemo(function(){return Ge.filter(function(e){var n=g(e.tabName);return!((!$||ne)&&"assignees"===n)&&(!re||"reminders"!==n)})},[Ge,$,ne,re]),Qe=u(null!==(_=null===(o=Ke[0])||void 0===o?void 0:o.tabName)&&void 0!==_?_:""),Xe=Qe[0],Ye=Qe[1],Ze=g(Xe),$e=d.useMemo(function(){return L(M||h)},[]),en=u($e),nn=en[0],rn=en[1],tn=u(x||!1),an=tn[0],on=tn[1],ln=u(k||null),sn=ln[0],dn=ln[1],un=d.useRef(!1),cn=d.useRef(!1),vn=d.useRef(!1),mn=d.useRef(R($e)),fn=d.useRef(!!x),pn=d.useRef(S(k||null)),yn=d.useCallback(function(e){un.current=!0,rn(e)},[]),hn=d.useCallback(function(e){cn.current=!0,on(e)},[]),bn=d.useCallback(function(e){vn.current=!0,dn(e)},[]),Dn=u(null),gn=Dn[0],wn=Dn[1],An=u([]),Ln=An[0],_n=An[1],Rn=u(ue||D),Sn=Rn[0],Tn=Rn[1],Cn=void 0!==ve?ve:Ln,Nn=void 0!==me?me:_n,qn=void 0!==ue?ue:Sn,Bn=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},Mn=function(){return Bn(new Date)},Fn=d.useMemo(function(){return{due_at:sn?sn.toISOString():"",assignee:nn.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,r){var t;return e(e({},n),((t={})[r]=i,t))},{})}},[sn,nn]);c(function(){void 0!==ue&&Tn(ue)},[ue]),c(function(){Y&&Y().then(function(e){Array.isArray(e)&&e.length>0?wn(e[0]):e&&!Array.isArray(e)&&wn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),c(function(){ye&&Ke.some(function(e){return e.tabName===ye})&&Ye(ye)},[ye,Ke]),c(function(){var e,n;Ke.some(function(e){return e.tabName===Xe})||Ye(null!==(n=null===(e=Ke[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[Ke,Xe]),c(function(){if(M){var e=L(M,nn),n=R(e),i=R(nn);n!==mn.current&&(un.current&&n!==i||(mn.current=n,un.current=!1,n!==i&&rn(e)))}},[M,nn]),c(function(){if(void 0!==x){var e=!!x;e!==fn.current&&(cn.current&&e!==an||(fn.current=e,cn.current=!1,e!==an&&on(e)))}},[x,an]),c(function(){if(void 0!==k){var e=null!=k?k:null,n=S(e),i=S(sn);n!==pn.current&&(vn.current&&n!==i||(pn.current=n,vn.current=!1,n!==i&&dn(e)))}},[k,sn]),c(function(){rn(function(i){var r,t=i.filter(function(e){return!e.isHidden}),a=i.find(function(e){return e.isHidden});if(an){var o=null===(r=null==a?void 0:a.assignees)||void 0===r?void 0:r[0],l=e(e({},o),{id:(null==o?void 0:o.id)||(null==gn?void 0:gn.id)||"me",email:(null==o?void 0:o.email)||(null==gn?void 0:gn.email)||"",name:C(o,gn),accessLevel:(null==o?void 0:o.accessLevel)||"Approve",role:(null==o?void 0:o.role)||"Final Approver"}),s=e(e({},a),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[l]});return A(n(n([],t,!0),[s],!1))}return A(t)})},[an,gn]),c(function(){var e=nn.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});Tn(function(n){var i=n.length===e.length&&e.every(function(e,i){var r;return(null===(r=n[i])||void 0===r?void 0:r.email)===e.email});return i?n:e.map(function(e,i){var r=n.find(function(n){return n.email===e.email});return r||{id:i+1,name:e.name,email:e.email,reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}})})},[nn]);var xn=nn.filter(function(e){return!e.isHidden}),On=xn.reduce(function(e,n){if(!n.dueDate)return e;var i=Bn(n.dueDate);return!e||i>e?i:e},null),kn=On&&On>Mn()?On:Mn(),Hn=xn.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,r=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!r}),jn=!1!==N.showFinalApprovalDueDate,In=K||(!!Hn||jn&&!sn),Pn=N.wrapperTitle||"Assign Redline and Manage Reminders",En=N.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Wn=N.wrapperPriority||"High",zn=N.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return r("div",e({style:e(e({},y.overlay),J.overlay)},{children:i("div",e({style:e(e(e(e({},y.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===Ze?{width:"1400px",maxWidth:"95vw"}:{}),J.modal)},{children:[i("div",e({style:e(e({},y.header),J.header)},{children:[i("div",e({style:e(e({},y.headerLeft),J.headerLeft)},{children:[r("span",e({style:e(e({},y.modalTitle),J.modalTitle)},{children:Pn})),i("div",e({style:e(e({},y.redlineRow),J.redlineRow)},{children:[r("span",e({style:e(e({},y.redlineName),J.redlineName)},{children:En})),r("span",e({style:e(e(e({},y.redlineBadge),zn),J.redlineBadge)},{children:Wn}))]}))]})),r("button",e({style:e(e({},y.closeBtn),J.closeBtn),onClick:j},{children:r(l,{size:20,color:"#6B7280"})}))]})),r("div",e({style:e(e({},y.tabBar),J.tabBar)},{children:Ke.map(function(n){var r=Xe===n.tabName;return i("button",e({style:e(e(e({},y.tab),J.tab),r?e(e({},y.tabActive),J.tabActive):{}),onClick:function(){return Ye(n.tabName)}},{children:[n.tabIcon," ",n.tabName]}),n.tabName)})})),i("div",e({style:e(e({},y.body),J.body)},{children:["assignees"===Ze&&i(t,{children:[!1!==N.showFinalApprovalDueDate&&i("div",e({style:e(e({},y.dueDateBar),J.dueDateBar)},{children:[i("span",e({style:e(e({},y.dueDateLabel),J.dueDateLabel)},{children:["Final Approval due date"," ",r("sup",e({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),r("div",e({style:e(e({},y.dueDateInputWrap),J.dueDateInputWrap)},{children:r(f,{value:sn?sn.toISOString().slice(0,10):"",onChange:function(e){var n="function"==typeof e?e(sn):e;n&&Bn(n)<kn?null==E||E("Final approval due date cannot be before the latest level due date"):bn(n?Bn(n):null)},minDate:kn,disabled:X.disableDueDates})})),i("span",e({style:e(e({},y.requiredToProceeed),J.requiredToProceeed)},{children:[r(s,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),r(v,{levels:nn,totalLevels:U,requireFinalApproval:an,setLevels:yn,setRequireFinalApproval:function(e){hn(e)},fetchUsers:I,onValidationError:E,customStyles:J,finalApprovalDueDate:sn,displayConfig:X})]}),"reminders"===Ze&&r(p,e({data:Fn,schedules:Cn,setSchedules:Nn,remainderOwners:qn,setRemainderOwners:function(e){var n="function"==typeof e?e(qn):e;ce?ce(n):Tn(n)},handelSendNow:function(e,n){fe&&fe(e||Cn,n||qn)},showPreviewEmail:null!=pe&&pe},void 0!==he&&{labels:he},void 0!==be&&{colors:be},void 0!==De&&{chipColor:De},void 0!==ge&&{assignees:ge},void 0!==we&&{fallbackRecipients:we},void 0!==Ae&&{recipientsColor:Ae},void 0!==Le&&{manualReminderTitle:Le},void 0!==_e&&{manualReminderDescription:_e},void 0!==Re&&{lastReminderText:Re},void 0!==Se&&{selectRecipientsLabel:Se},void 0!==Te&&{previewEmailButtonLabel:Te},void 0!==Ce&&{sendNowButtonLabel:Ce},void 0!==Ne&&{reminderSuccessTitle:Ne},void 0!==qe&&{reminderSuccessDescription:qe},void 0!==Be&&{escalationTitle:Be},void 0!==Me&&{escalationTitleTooltip:Me},void 0!==Fe&&{escalationDescription:Fe},void 0!==xe&&{configureAutoReminderText:xe},void 0!==Oe&&{getDynamicStatement:Oe},void 0!==ke&&{reminderStartDateLabel:ke},void 0!==He&&{documentDueDateLabel:He},void 0!==je&&{reminderFrequencyLabel:je},void 0!==Ie&&{escalationRemindersLabel:Ie},void 0!==Pe&&{escalationTooltip:Pe},void 0!==Ee&&{escalationConditionText:Ee},void 0!==We&&{daysText:We},void 0!==ze&&{dueDataAndRepeatText:ze},void 0!==Ue&&{reminderFrequencyOptions:Ue},void 0!==Ve&&{escalationFrequencyOptions:Ve},void 0!==Je&&{beforeAfterOptions:Je})),"review"===Ze&&r(m,{levels:nn,reviewData:B,showApproveAndMoveToNextLevelButton:W,onApproveAndMoveToNextLevel:z})]})),!de&&(!ae||!le)&&i("div",e({style:e(e({},y.footer),J.footer)},{children:[!ae&&r("button",e({style:e(e(e({},y.clearBtn),J.clearBtn),K?J.actionBtnDisabled:{}),onClick:function(){yn(w(h.map(function(n){return e(e({},n),{assignees:[],dueDate:null})}))),hn(!1),bn(null)},disabled:K},{children:"Clear"})),!le&&r("button",e({style:e(e(e({},y.saveBtn),J.saveBtn),In?e({opacity:.55,cursor:"not-allowed"},J.actionBtnDisabled):{}),onClick:function(){if(In)K||null==E||E(function(){if(jn&&!sn)return"Final approval due date is required";if(!Hn)return"Please fill all required fields before saving";var e=xn.indexOf(Hn)+1,n=[Hn.dueDate?null:"due date",(Hn.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})?null:"assignee"].filter(Boolean);return"Level ".concat(e," ").concat(n.join(" and ")," ").concat(n.length>1?"are":"is"," required")}());else{var e=A(nn.filter(function(e){return!e.isHidden}));null==F||F(e),null==O||O(an),null==H||H(sn),null==P||P({levels:e,requireFinalApproval:an,finalApprovalDueDate:sn,activeTab:Ze,schedules:Cn,remainderOwners:qn})}},disabled:In},{children:"Save Changes"}))]}))]}))}))}export{N as AssignReminderWrapper,h as INITIAL_LEVELS};
|
|
1
|
+
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as r,Fragment as t}from"react/jsx-runtime";import{Bell as a,ClipboardList as o,X as l,CircleAlert as s}from"lucide-react";import d,{useState as u,useEffect as c}from"react";import{AssignReminderLevels as v}from"./AssignReminderLevels.js";import m from"./components/ReviewStatus.js";import p from"./components/CustomDatePicker.js";import{getLatestLevelDueDate as f,getApprovalDateValidationError as y,startOfCalendarDay as h,normalizeApprovalDate as b}from"./utils/approvalDateValidation.js";import{ManageReminders as D}from"./ManageReminders.js";import{DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES as g}from"./styles/AssignReminderWrapperStyles.js";var w=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],A=[{tabName:"Assignees & Approvers",tabIcon:i("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[r("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),r("circle",{cx:"9",cy:"7",r:"4"}),r("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),r("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:r(a,{size:15})},{tabName:"Review Status",tabIcon:r(o,{size:15})}],L=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function _(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}var R=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e(e({},n),{isMandatory:!0,hasDueDate:!0})})},S=function(n){return n.map(function(n){var i;return e(e({},n),{assignees:(null!==(i=n.assignees)&&void 0!==i?i:[]).map(function(n){var i=n.accessLevel||n.role||"";return e(e({},n),{role:i,accessLevel:i})})})})},T=function(e,i){void 0===e&&(e=w),void 0===i&&(i=[]);var r=e.find(function(e){return e.isHidden}),t=i.find(function(e){return e.isHidden}),a=e.filter(function(e){return!e.isHidden}),o=r||t,l=o?n(n([],a,!0),[o],!1):a;return S(R(l))},N=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();return Number.isFinite(i)?n.toISOString():""},C=function(e){return void 0===e&&(e=[]),JSON.stringify(e.map(function(e){var n,i,r,t;return{headerName:null!==(n=e.headerName)&&void 0!==n?n:"",title:null!==(i=e.title)&&void 0!==i?i:"",isMandatory:!!e.isMandatory,hasDueDate:!!e.hasDueDate,isHidden:!!e.isHidden,dueDate:N(e.dueDate),status:null!==(r=e.status)&&void 0!==r?r:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(t=e.assignees)&&void 0!==t?t:[]).map(function(e){var n,i,r,t,a,o,l,s,d,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(r=e.email)&&void 0!==r?r:"",accessLevel:null!==(a=null!==(t=e.accessLevel)&&void 0!==t?t:e.role)&&void 0!==a?a:"",role:null!==(l=null!==(o=e.role)&&void 0!==o?o:e.accessLevel)&&void 0!==l?l:"",notes:null!==(s=e.notes)&&void 0!==s?s:"",sendMailNow:!!e.sendMailNow,action:null!==(d=e.action)&&void 0!==d?d:"",action_taken_at:null!==(u=e.action_taken_at)&&void 0!==u?u:""}})}}))},F=function(e){return N(e)},M=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();if(!Number.isFinite(i))return"";var r=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return"".concat(r,"-").concat(t,"-").concat(a)},q=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return"username (you)"===n||"username"===n},B=function(e,n){return q(null==e?void 0:e.name)?q(null==n?void 0:n.name)?(null==e?void 0:e.email)||(null==n?void 0:n.email)||"Owner":n.name:e.name};function x(a){var o,N,q=a.metadata,x=void 0===q?{}:q,O=a.reviewData,k=void 0===O?{}:O,H=a.levels,j=a.setLevels,I=a.requireFinalApproval,P=a.setRequireFinalApproval,E=a.approvalDueDate,W=a.setApprovalDueDate,z=a.onClose,V=a.fetchUsers,U=a.onSave,J=a.onValidationError,Y=a.showApproveAndMoveToNextLevelButton,G=a.onApproveAndMoveToNextLevel,K=a.totalLevels,Q=a.customStyles,X=void 0===Q?{}:Q,Z=a.isSaving,$=void 0!==Z&&Z,ee=a.displayConfig,ne=void 0===ee?{}:ee,ie=a.onRequireFinalApproval,re=a.isOwner,te=void 0===re||re,ae=a.blockEditScreen,oe=void 0!==ae&&ae,le=a.hideManageReminders,se=void 0!==le&&le,de=a.hideClearButton,ue=void 0!==de&&de,ce=a.hideSaveChangesButton,ve=void 0!==ce&&ce,me=a.hideFooterActions,pe=void 0!==me&&me;a.hideAssigneeApproverScreen,a.remindersData;var fe=a.remainderOwners,ye=a.setRemainderOwners,he=a.schedules,be=a.setSchedules,De=a.handelSendNow,ge=a.showPreviewEmail,we=a.tabName,Ae=a.reminderLabels,Le=a.reminderColors,_e=a.reminderChipColor,Re=a.reminderAssignees,Se=a.reminderFallbackRecipients,Te=a.reminderRecipientsColor,Ne=a.manualReminderTitle,Ce=a.manualReminderDescription,Fe=a.lastReminderText,Me=a.selectRecipientsLabel,qe=a.previewEmailButtonLabel,Be=a.sendNowButtonLabel,xe=a.reminderSuccessTitle,Oe=a.reminderSuccessDescription,ke=a.escalationTitle,He=a.escalationTitleTooltip,je=a.escalationDescription,Ie=a.configureAutoReminderText,Pe=a.getDynamicStatement,Ee=a.reminderStartDateLabel,We=a.documentDueDateLabel,ze=a.reminderFrequencyLabel,Ve=a.escalationRemindersLabel,Ue=a.escalationTooltip,Je=a.escalationConditionText,Ye=a.daysText,Ge=a.dueDataAndRepeatText,Ke=a.reminderFrequencyOptions,Qe=a.escalationFrequencyOptions,Xe=a.beforeAfterOptions,Ze=d.useMemo(function(){var e;return(null===(e=x.tabData)||void 0===e?void 0:e.length)?x.tabData:A},[x.tabData]),$e=d.useMemo(function(){return Ze.filter(function(e){var n=_(e.tabName);return!((!te||oe)&&"assignees"===n)&&(!se||"reminders"!==n)})},[Ze,te,oe,se]),en=u(null!==(N=null===(o=$e[0])||void 0===o?void 0:o.tabName)&&void 0!==N?N:""),nn=en[0],rn=en[1],tn=_(nn),an=d.useMemo(function(){return T(H||w)},[]),on=u(an),ln=on[0],sn=on[1],dn=u(I||!1),un=dn[0],cn=dn[1],vn=u(E||null),mn=vn[0],pn=vn[1],fn=d.useRef(!1),yn=d.useRef(!1),hn=d.useRef(!1),bn=d.useRef(C(an)),Dn=d.useRef(!!I),gn=d.useRef(F(E||null)),wn=d.useCallback(function(e){fn.current=!0,sn(e)},[]),An=d.useCallback(function(e){yn.current=!0,cn(e)},[]),Ln=d.useCallback(function(e){hn.current=!0,pn(e)},[]),_n=u(null),Rn=_n[0],Sn=_n[1],Tn=u([]),Nn=Tn[0],Cn=Tn[1],Fn=u(fe||L),Mn=Fn[0],qn=Fn[1],Bn=void 0!==he?he:Nn,xn=void 0!==be?be:Cn,On=void 0!==fe?fe:Mn,kn=function(){return h(new Date)},Hn=d.useMemo(function(){return{due_at:mn?mn.toISOString():"",assignee:ln.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,r){var t;return e(e({},n),((t={})[r]=i,t))},{})}},[mn,ln]);c(function(){void 0!==fe&&qn(fe)},[fe]),c(function(){ie&&ie().then(function(e){Array.isArray(e)&&e.length>0?Sn(e[0]):e&&!Array.isArray(e)&&Sn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),c(function(){we&&$e.some(function(e){return e.tabName===we})&&rn(we)},[we,$e]),c(function(){var e,n;$e.some(function(e){return e.tabName===nn})||rn(null!==(n=null===(e=$e[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[$e,nn]),c(function(){if(H){var e=T(H,ln),n=C(e),i=C(ln);n!==bn.current&&(fn.current&&n!==i||(bn.current=n,fn.current=!1,n!==i&&sn(e)))}},[H,ln]),c(function(){if(void 0!==I){var e=!!I;e!==Dn.current&&(yn.current&&e!==un||(Dn.current=e,yn.current=!1,e!==un&&cn(e)))}},[I,un]),c(function(){if(void 0!==E){var e=null!=E?E:null,n=F(e),i=F(mn);n!==gn.current&&(hn.current&&n!==i||(gn.current=n,hn.current=!1,n!==i&&pn(e)))}},[E,mn]),c(function(){sn(function(i){var r,t=i.filter(function(e){return!e.isHidden}),a=i.find(function(e){return e.isHidden});if(un){var o=null===(r=null==a?void 0:a.assignees)||void 0===r?void 0:r[0],l=e(e({},o),{id:(null==o?void 0:o.id)||(null==Rn?void 0:Rn.id)||"me",email:(null==o?void 0:o.email)||(null==Rn?void 0:Rn.email)||"",name:B(o,Rn),accessLevel:(null==o?void 0:o.accessLevel)||"Approve",role:(null==o?void 0:o.role)||"Final Approver"}),s=e(e({},a),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[l]});return S(n(n([],t,!0),[s],!1))}return S(t)})},[un,Rn]),c(function(){var e=ln.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});qn(function(n){var i=n.length===e.length&&e.every(function(e,i){var r;return(null===(r=n[i])||void 0===r?void 0:r.email)===e.email});return i?n:e.map(function(e,i){var r=n.find(function(n){return n.email===e.email});return r||{id:i+1,name:e.name,email:e.email,reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}})})},[ln]);var jn=ln.filter(function(e){return!e.isHidden}),In=f(jn),Pn=In&&In>kn()?In:kn(),En=jn.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,r=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!r}),Wn=!1!==x.showFinalApprovalDueDate,zn=!!En||Wn&&!mn,Vn=y(jn,mn),Un=$||zn||!!Vn,Jn=x.wrapperTitle||"Assign Redline and Manage Reminders",Yn=x.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Gn=x.wrapperPriority||"High",Kn=x.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return r("div",e({style:e(e({},g.overlay),X.overlay)},{children:i("div",e({style:e(e(e(e({},g.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===tn?{width:"1400px",maxWidth:"95vw"}:{}),X.modal)},{children:[i("div",e({style:e(e({},g.header),X.header)},{children:[i("div",e({style:e(e({},g.headerLeft),X.headerLeft)},{children:[r("span",e({style:e(e({},g.modalTitle),X.modalTitle)},{children:Jn})),i("div",e({style:e(e({},g.redlineRow),X.redlineRow)},{children:[r("span",e({style:e(e({},g.redlineName),X.redlineName)},{children:Yn})),r("span",e({style:e(e(e({},g.redlineBadge),Kn),X.redlineBadge)},{children:Gn}))]}))]})),r("button",e({style:e(e({},g.closeBtn),X.closeBtn),onClick:z},{children:r(l,{size:20,color:"#6B7280"})}))]})),r("div",e({style:e(e({},g.tabBar),X.tabBar)},{children:$e.map(function(n){var r=nn===n.tabName;return i("button",e({style:e(e(e({},g.tab),X.tab),r?e(e({},g.tabActive),X.tabActive):{}),onClick:function(){return rn(n.tabName)}},{children:[n.tabIcon," ",n.tabName]}),n.tabName)})})),i("div",e({style:e(e({},g.body),X.body)},{children:["assignees"===tn&&i(t,{children:[!1!==x.showFinalApprovalDueDate&&i("div",e({style:e(e({},g.dueDateBar),X.dueDateBar)},{children:[i("span",e({style:e(e({},g.dueDateLabel),X.dueDateLabel)},{children:["Final Approval due date"," ",r("sup",e({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),r("div",e({style:e(e({},g.dueDateInputWrap),X.dueDateInputWrap)},{children:r(p,{value:M(mn),onChange:function(e){var n="function"==typeof e?e(mn):e;n&&h(n)<Pn?null==J||J("Final approval due date cannot be before the latest level due date"):Ln(n?b(n):null)},minDate:Pn,disabled:ne.disableDueDates})})),i("span",e({style:e(e({},g.requiredToProceeed),X.requiredToProceeed)},{children:[r(s,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),r(v,{levels:ln,totalLevels:K,requireFinalApproval:un,setLevels:wn,setRequireFinalApproval:function(e){An(e)},fetchUsers:V,onValidationError:J,customStyles:X,finalApprovalDueDate:mn,displayConfig:ne})]}),"reminders"===tn&&r(D,e({data:Hn,schedules:Bn,setSchedules:xn,remainderOwners:On,setRemainderOwners:function(e){var n="function"==typeof e?e(On):e;ye?ye(n):qn(n)},handelSendNow:function(e,n){De&&De(e||Bn,n||On)},showPreviewEmail:null!=ge&&ge},void 0!==Ae&&{labels:Ae},void 0!==Le&&{colors:Le},void 0!==_e&&{chipColor:_e},void 0!==Re&&{assignees:Re},void 0!==Se&&{fallbackRecipients:Se},void 0!==Te&&{recipientsColor:Te},void 0!==Ne&&{manualReminderTitle:Ne},void 0!==Ce&&{manualReminderDescription:Ce},void 0!==Fe&&{lastReminderText:Fe},void 0!==Me&&{selectRecipientsLabel:Me},void 0!==qe&&{previewEmailButtonLabel:qe},void 0!==Be&&{sendNowButtonLabel:Be},void 0!==xe&&{reminderSuccessTitle:xe},void 0!==Oe&&{reminderSuccessDescription:Oe},void 0!==ke&&{escalationTitle:ke},void 0!==He&&{escalationTitleTooltip:He},void 0!==je&&{escalationDescription:je},void 0!==Ie&&{configureAutoReminderText:Ie},void 0!==Pe&&{getDynamicStatement:Pe},void 0!==Ee&&{reminderStartDateLabel:Ee},void 0!==We&&{documentDueDateLabel:We},void 0!==ze&&{reminderFrequencyLabel:ze},void 0!==Ve&&{escalationRemindersLabel:Ve},void 0!==Ue&&{escalationTooltip:Ue},void 0!==Je&&{escalationConditionText:Je},void 0!==Ye&&{daysText:Ye},void 0!==Ge&&{dueDataAndRepeatText:Ge},void 0!==Ke&&{reminderFrequencyOptions:Ke},void 0!==Qe&&{escalationFrequencyOptions:Qe},void 0!==Xe&&{beforeAfterOptions:Xe})),"review"===tn&&r(m,{levels:ln,reviewData:k,showApproveAndMoveToNextLevelButton:Y,onApproveAndMoveToNextLevel:G})]})),!pe&&(!ue||!ve)&&i("div",e({style:e(e({},g.footer),X.footer)},{children:[!ue&&r("button",e({style:e(e(e({},g.clearBtn),X.clearBtn),$?X.actionBtnDisabled:{}),onClick:function(){wn(R(w.map(function(n){return e(e({},n),{assignees:[],dueDate:null})}))),An(!1),Ln(null)},disabled:$},{children:"Clear"})),!ve&&r("button",e({style:e(e(e({},g.saveBtn),X.saveBtn),Un?e({opacity:.55,cursor:"not-allowed"},X.actionBtnDisabled):{}),onClick:function(){if(Un)$||null==J||J(Vn||function(){if(Wn&&!mn)return"Final approval due date is required";if(!En)return"Please fill all required fields before saving";var e=jn.indexOf(En)+1,n=[En.dueDate?null:"due date",(En.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})?null:"assignee"].filter(Boolean);return"Level ".concat(e," ").concat(n.join(" and ")," ").concat(n.length>1?"are":"is"," required")}());else{var e=S(ln.filter(function(e){return!e.isHidden}));null==j||j(e),null==P||P(un),null==W||W(mn),null==U||U({levels:e,requireFinalApproval:un,finalApprovalDueDate:mn,activeTab:tn,schedules:Bn,remainderOwners:On})}},disabled:Un},{children:"Save Changes"}))]}))]}))}))}export{x as AssignReminderWrapper,w as INITIAL_LEVELS};
|
|
2
2
|
//# sourceMappingURL=AssignReminderWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as n}from"react/jsx-runtime";import{useState as t,useEffect as r}from"react";import{Send as o,ChevronDown as l,CircleCheckBigIcon as d,Mail as a,InfoIcon as s,ArrowRight as c,CalendarIcon as u,ChevronRight as m,ChevronLeft as v}from"lucide-react";import h from"@mui/material/Checkbox";import{Chip as y,Box as p,Autocomplete as f,TextField as g}from"@mui/material";import{useDragControls as b,AnimatePresence as x,motion as C,Reorder as F}from"framer-motion";import k from"@mui/icons-material/DragIndicator";import{LocalizationProvider as D,DatePicker as R}from"@mui/x-date-pickers";import{AdapterDayjs as E}from"@mui/x-date-pickers/AdapterDayjs";import w from"./components/ReminderFrequencyAutocomplete.js";import S from"./components/AssigneeCalendarView.js";import _ from"dayjs";import{styles as I}from"./styles/ManageReminder.style.js";var A=["Assignee 1","Assignee 2","Assignee 3"],B=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],T=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],L=[{id:"1",name:"Assignee 1",color:"#C11574",bg:"#FDF2F8",startDate:new Date("2026-11-09"),dueDate:new Date("2026-12-01")},{id:"2",name:"Assignee 2",color:"#3538CD",bg:"#EEF4FF",startDate:new Date("2026-11-21"),dueDate:new Date("2026-12-03")},{id:"3",name:"Assignee 3",color:"#FF6058",bg:"#FFF7ED",startDate:new Date("2026-12-01"),dueDate:new Date("2026-12-03")}],P=[{bg:"#DBEAFE",text:"#1E40AF"},{bg:"#CCFBF1",text:"#0D9488"},{bg:"#DCFCE7",text:"#166534"}],O=[{initials:"OR",name:"Olivia Rhye",checked:!1,bg:"#DBEAFE",text:"#1D4ED8"},{initials:"DM",name:"Daniela Mark",checked:!1,bg:"#CFFAFE",text:"#0F766E"},{initials:"JB",name:"Jenna Beckner",checked:!1,bg:"#D1FAE5",text:"#059669"}],M=function(e){var i,n,t,r,o,l,d,a;return(null==e?void 0:e.is_escalation_reminder)&&(null===(i=null==e?void 0:e.days)||void 0===i?void 0:i.value)&&"undefined"!==(null===(n=null==e?void 0:e.days)||void 0===n?void 0:n.value)&&(null===(t=null==e?void 0:e.escalation_reminder_frequency)||void 0===t?void 0:t.value)&&"undefined"!==(null===(r=null==e?void 0:e.escalation_reminder_frequency)||void 0===r?void 0:r.value)?"Start notifying ".concat((null===(o=null==e?void 0:e.days)||void 0===o?void 0:o.value.includes("day"))?null===(l=null==e?void 0:e.days)||void 0===l?void 0:l.value:"".concat(null===(d=null==e?void 0:e.days)||void 0===d?void 0:d.value," ").concat(1===Number(null===(a=null==e?void 0:e.days)||void 0===a?void 0:a.value)?"day":"days")," ").concat(null==e?void 0:e.before_or_after," the due date"):"Notify until successful document upload"},q={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}},Y=function(Y){var j=Y.data,N=Y.schedules,H=Y.setSchedules,z=Y.remainderOwners,W=Y.setRemainderOwners,G=Y.labels,V=void 0===G?A:G,U=Y.colors,J=void 0===U?B:U,Z=Y.chipColor,K=void 0===Z?T:Z,Q=Y.assignees,X=void 0===Q?L:Q,$=Y.fallbackRecipients,ee=void 0===$?O:$,ie=Y.recipientsColor,ne=void 0===ie?P:ie,te=Y.manualReminderTitle,re=void 0===te?"Send Manual Reminder Now":te,oe=Y.manualReminderDescription,le=void 0===oe?"Immediately notify the assignees about this document.":oe;Y.lastReminderText;var de=Y.selectRecipientsLabel,ae=void 0===de?"Select recipients:":de,se=Y.previewEmailButtonLabel,ce=void 0===se?"Preview Email":se,ue=Y.sendNowButtonLabel,me=void 0===ue?"Send Now":ue,ve=Y.reminderSuccessTitle,he=void 0===ve?"Reminder sent successfully!":ve,ye=Y.reminderSuccessDescription,pe=void 0===ye?"Email notification sent to assignees.":ye,fe=Y.escalationTitle,ge=void 0===fe?"Escalation and Auto Reminder Setup":fe;Y.escalationTitleTooltip;var be=Y.escalationDescription,xe=void 0===be?"Configure Auto reminder settings for all assignees.":be;Y.configureAutoReminderText;var Ce=Y.getDynamicStatement,Fe=void 0===Ce?M:Ce,ke=Y.reminderStartDateLabel,De=void 0===ke?"Reminder Start Date":ke,Re=Y.documentDueDateLabel,Ee=void 0===Re?"Document Due Date":Re,we=Y.reminderFrequencyLabel,Se=void 0===we?"Reminder Frequency":we,_e=Y.escalationRemindersLabel,Ie=void 0===_e?"Escalation Reminders":_e;Y.escalationTooltip;var Ae=Y.escalationConditionText,Be=void 0===Ae?"If the document is still pending, start escalation reminders":Ae,Te=Y.daysText,Le=void 0===Te?"days":Te,Pe=Y.dueDataAndRepeatText,Oe=void 0===Pe?"due date and repeat every":Pe,Me=Y.reminderFrequencyOptions,qe=void 0===Me?["12 hours","24 hours","48 hours","72 hours","Custom"]:Me,Ye=Y.escalationFrequencyOptions,je=void 0===Ye?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:Ye,Ne=Y.beforeAfterOptions,He=void 0===Ne?["After","Before"]:Ne,ze=Y.handelSendNow,We=Y.showPreviewEmail,Ge=void 0===We||We,Ve=t(!1),Ue=Ve[0],Je=Ve[1],Ze=t(!1),Ke=Ze[0],Qe=Ze[1],Xe=t(!1),$e=Xe[0],ei=Xe[1],ii=t(!0),ni=ii[0],ti=ii[1],ri=t(ee),oi=ri[0],li=ri[1],di=b(),ai=function(i,n,t){W(function(r){return r.map(function(r,o){var l;return o===i?e(e({},r),((l={})[n]=t,l)):r})})},si=function(e,i){ai(e,"reminder_start_date",i)},ci=function(e){var i;if(!e)return null;if("custom"===e.type)return Number(e.value)<=0?null:60*Number(e.value)*60*1e3;return null!==(i={"1/2 hour":18e5,"1 hour":36e5,"4 hours":144e5,"6 hours":216e5,"12 hours":432e5,"24 hours":864e5,"48 hours":1728e5,"72 hours":2592e5,"96 hours":3456e5,"1/2 day":432e5,"1 day":864e5,"2 days":1728e5,"3 days":2592e5,"4 days":3456e5}[e.value])&&void 0!==i?i:null},ui=function(e,i,n){if(!e||!n)return[];var t=ci(n);if(!t||t<=0)return[];for(var r=[],o=_(e).valueOf(),l=i?_(i).valueOf():_(e).add(45,"day").valueOf(),d=0;o<=l&&d<150;)r.push(_(o).toISOString()),o+=t,d++;return r},mi=function(e,i,n,t){if(!(e&&i&&t&&n))return[];var r=ci(t);if(!r)return[];var o,l=_(e),d="custom"===i.type?Number(i.value):Number("1/2"===i.value.split(" ")[0]?.5:Number(i.value.split(" ")[0])),a=[];switch(n){case"Before":o=l.subtract(d,"day");break;case"After":o=l.add(d,"day");break;default:return[]}for(var s=o.valueOf(),c=0;c<150;c++)a.push(_(s).toISOString()),s+=r;return a},vi=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};r(function(){var e=(null==j?void 0:j.due_at)||"",i=Object.values((null==j?void 0:j.assignee)||{}),n=null==z?void 0:z.map(function(n,t){var r,o=i[t]||X.find(function(e){return e.id===String(n.id)}),l=(null===(r=null==J?void 0:J[t%J.length])||void 0===r?void 0:r.text)||"#C11574";return{ownerId:n.id||t+1,ownerName:(null==o?void 0:o.name)||n.name,ownerColor:(null==o?void 0:o.color)||l,reminders:ui(n.reminder_start_date,e,n.reminder_frequency),escalations:mi(e,n.days,n.before_or_after,n.escalation_reminder_frequency)}});H(n)},[z,null==j?void 0:j.due_at,null==j?void 0:j.assignee]),r(function(){(null==j?void 0:j.assignee)&&li(function(e){var i=Object.values(j.assignee).filter(function(e){return e&&Object.keys(e).length>0}).map(function(i,n){var t=e.find(function(e){return e.name===i.name});return{name:i.name,checked:!!t&&t.checked,recipientsColor:(null==ne?void 0:ne[n])||P[n%P.length]}});return i.length>0?i:ee})},[null==j?void 0:j.assignee,null==j?void 0:j.due_at]);var hi=Object.values((null==j?void 0:j.assignee)||{}).filter(function(e){return null==e?void 0:e.name});return i("div",e({style:e(e({},I.mrContainer),{width:"100%",minWidth:"850px"})},{children:[i("div",e({style:I.mrSectionBox},{children:[i("div",e({style:e(e({},I.mrSectionHeader),{cursor:"pointer"}),onClick:function(){return Je(function(e){return!e})}},{children:[i("div",e({style:I.mrSectionHeaderContent},{children:[i("div",e({style:I.mrSectionHeaderLeft},{children:[i("div",e({style:I.mrSectionTitleWrapper},{children:[n("div",e({style:I.mrSectionTitleIcon},{children:n(o,{style:I.mrIconSmall})})),n("div",e({style:I.mrSectionTitle},{children:re}))]})),n("div",e({style:I.mrSectionDescription},{children:le}))]})),n("div",e({style:I.mrSectionHeaderRight},{children:n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Je(function(e){return!e})},style:I.mrChevronButton},{children:n(l,{style:e(e({},I.mrChevronIcon),Ue?I.mrChevronRotated:{})})}))}))]})),n(x,{children:$e&&i(C.div,e({initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:I.mrSuccessMessage},{children:[n("div",e({style:I.mrSuccessIcon},{children:n("div",e({style:I.mrSuccessIconInner},{children:n(d,{style:I.mrIconSuccess})}))})),i("div",e({style:I.mrSuccessText},{children:[n("div",e({style:I.mrSuccessTitle},{children:he})),n("div",e({style:I.mrSuccessDescription},{children:pe}))]}))]}))})]})),n(x,{children:Ue&&i(C.div,e({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:e(e({},I.mrHiddenSection),{pointerEvents:Ue?"auto":"none"})},{children:[i("div",e({style:I.mrRecipientsSection},{children:[n("div",e({style:I.mrRecipientsLabel},{children:ae})),n("div",e({style:I.mrRecipientsGrid},{children:oi.map(function(t,r){var o,l,d,a,s=(null===(o=null==t?void 0:t.recipientsColor)||void 0===o?void 0:o.bg)||(null==t?void 0:t.bg)||(null===(l=P[r%P.length])||void 0===l?void 0:l.bg)||"#DBEAFE",c=(null===(d=null==t?void 0:t.recipientsColor)||void 0===d?void 0:d.text)||(null==t?void 0:t.text)||(null===(a=P[r%P.length])||void 0===a?void 0:a.text)||"#1E40AF";return i("div",e({style:I.mrRecipientItem},{children:[n(h,{checked:t.checked,onChange:function(){return i=t.name,void li(function(n){return n.map(function(n){return n.name===i?e(e({},n),{checked:!n.checked}):n})});var i},onClick:function(e){return e.stopPropagation()},size:"small",disableRipple:!0,icon:n("div",{style:I.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:I.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:I.mrCheckboxIcon},{children:n("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),i("div",e({style:I.mrRecipientInfo},{children:[n("div",e({style:e(e({},I.mrRecipientAvatar),{backgroundColor:s,color:c})},{children:vi(t.name)})),n("div",e({style:I.mrRecipientName},{children:t.name}))]}))]}),t.name)})}))]})),i("div",e({style:I.mrActionsSection},{children:[Ge&&i("button",e({onClick:function(e){e.stopPropagation()},type:"button",style:e(e({},I.mrActionButton),I.mrActionButtonSecondary)},{children:[n(a,{style:I.mrIconAction}),ce]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),ei(!0),setTimeout(function(){return ei(!1)},3e3);var i=oi.filter(function(e){return e.checked});ze(N,z.filter(function(e){return i.some(function(i){return i.id===e.id})}))},style:e(e({},I.mrActionButton),I.mrActionButtonPrimary)},{children:me}))]}))]}))})]})),i("div",e({style:I.mrMainContent},{children:[i("div",e({style:I.mrEscalationContainer},{children:[i("div",e({style:I.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Qe(function(e){return!e})}},{children:[i("div",e({style:I.mrEscalationHeader},{children:[i("div",e({style:I.mrEscalationTitleWrapper},{children:[n("div",e({style:I.mrEscalationTitleText},{children:ge})),n("div",e({style:I.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:I.mrIconInfo})}))]})),i("div",e({style:I.mrEscalationActions},{children:[Ge&&i("button",e({style:I.mrEscalationPreviewButton},{children:[n("div",e({style:I.mrEscalationPreviewIcon},{children:n(a,{style:I.mrIconPreview})})),n("span",e({style:I.mrEscalationPreviewText},{children:ce}))]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Qe(function(e){return!e})},style:I.mrChevronButton},{children:n(l,{style:e(e({},I.mrChevronIcon),Ke?I.mrChevronRotated:{})})}))]}))]})),n("div",e({style:I.mrEscalationDescription},{children:xe}))]})),n(x,e({initial:!1},{children:Ke&&n(C.div,e({layout:!0,initial:{opacity:0,scaleY:.96},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:.96},transition:{duration:.3,ease:"easeInOut"},style:{transformOrigin:"top",overflow:"hidden"}},{children:n(F.Group,e({axis:"y",values:z||[],onReorder:function(e){W(e)},layoutScroll:!0,style:I.mrReorderGroup},{children:null==z?void 0:z.map(function(t,r){var o,d,a,u,m=hi[r]||ee[r],v=(null===(o=null==J?void 0:J[r])||void 0===o?void 0:o.bg)||"#FDF2FA",b=(null===(d=null==J?void 0:J[r])||void 0===d?void 0:d.text)||"#C11574",S=(null===(a=null==K?void 0:K[r])||void 0===a?void 0:a.bg)||"transparent",A=(null===(u=null==K?void 0:K[r])||void 0===u?void 0:u.text)||"inherit";return n(F.Item,e({value:t,dragControls:di,layout:"position"},{children:i("div",e({style:I.mrReminderItem},{children:[n("div",e({style:I.mrReminderLabelBox},{children:n("div",e({style:I.mrReminderLabelInner},{children:n(y,{label:(null==V?void 0:V[r])||"Assignee ".concat(r+1),sx:{backgroundColor:v,minWidth:90,color:b,fontWeight:500}})}))})),i("div",e({style:I.mrReminderContent},{children:[n("div",e({style:I.mrDragHandle},{children:n(k,{onPointerDown:function(e){return di.start(e)},sx:{color:"#9e9e9e"}})})),n(p,e({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:I.mrReminderBox},{children:i("div",e({style:I.mrReminderFields},{children:[i("div",e({style:I.mrReminderHeader},{children:[i("div",e({style:I.mrReminderAssignee},{children:[n("div",e({style:I.mrReminderAvatar},{children:n("span",e({style:I.mrReminderInitials},{children:vi(null==m?void 0:m.name)}))})),n("span",e({style:I.mrReminderName},{children:null==m?void 0:m.name}))]})),n("div",e({style:e(e({},I.mrReminderStatement),{backgroundColor:S})},{children:n("span",e({style:e(e({},I.mrReminderStatementText),{color:A})},{children:Fe(t)}))}))]})),i("div",e({style:I.mrReminderDateFields},{children:[i("div",e({style:I.mrReminderField},{children:[n("p",e({style:I.mrReminderFieldLabel},{children:De})),i("div",e({style:I.mrReminderDatePicker},{children:[n(D,e({dateAdapter:E},{children:n(R,{value:t.reminder_start_date?_(t.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&_(e).isValid()){if(_(e).isBefore(_(),"day"))return;si(r,_(e).toISOString())}else si(r,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:q,placeholder:"MM/DD/YYYY"},openPickerButton:{id:"trial-start-date-picker-icon","data-testid":"trial-start-date-picker-icon",size:"small"},openPickerIcon:{sx:{fontSize:"14px"}}}})})),n(c,{style:I.mrIconArrow})]}))]})),i("div",e({style:I.mrReminderField},{children:[n("p",e({style:I.mrReminderFieldLabel},{children:Ee})),n("div",e({style:I.mrReminderDueDate},{children:(null==j?void 0:j.due_at)?_(j.due_at).format("MM/DD/YYYY"):""}))]})),i("div",e({style:I.mrReminderField},{children:[n("p",e({style:I.mrReminderFieldLabel},{children:Se})),i("div",e({style:I.mrReminderFrequency},{children:[n("span",e({style:I.mrReminderFrequencyText},{children:"Every"})),n(w,{value:t.reminder_frequency,onChange:function(e){return function(e,i){ai(e,"reminder_frequency",i)}(r,e)},options:qe,suffix:"hours"})]}))]}))]})),i("div",e({style:I.mrEscalationCheckbox},{children:[i("div",e({style:I.mrEscalationCheckboxHeader},{children:[n(h,{size:"small",disableRipple:!0,checked:t.is_escalation_reminder,onChange:function(e){return function(e,i){ai(e,"is_escalation_reminder",i),i||(ai(e,"days",{type:"preset",value:""}),ai(e,"escalation_reminder_frequency",{type:"preset",value:""}),ai(e,"before_or_after",""))}(r,e.target.checked)},icon:n("div",{style:I.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:I.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:I.mrCheckboxIcon},{children:n("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),Ie,n("div",e({style:I.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:I.mrIconInfo})}))]})),n(x,{children:t.is_escalation_reminder&&i(C.div,e({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:I.mrEscalationContent},{children:[n("div",e({style:I.mrEscalationCondition},{children:Be})),i("div",e({style:I.mrEscalationFields},{children:[i("div",e({style:I.mrEscalationFieldGroup},{children:[n(w,{value:t.days,onChange:function(e){return function(e,i){ai(e,"days",i)}(r,e)}}),n("div",e({style:I.mrEscalationFieldText},{children:Le}))]})),i("div",e({style:e(e({},I.mrEscalationFieldGroup),I.mrEscalationFieldGroupLarge)},{children:[n(f,{size:"small",options:He,value:t.before_or_after,onChange:function(e,i){return function(e,i){ai(e,"before_or_after",i)}(r,i||"")},popupIcon:n(l,{style:I.mrIconDropdown}),slotProps:{paper:{sx:{"& .MuiAutocomplete-option":{fontSize:"12px",minHeight:"32px"}}},clearIndicator:{sx:{"& svg":{fontSize:12}}}},renderInput:function(i){return n(g,e({},i,{placeholder:"Select value",sx:q}))},sx:{width:"100%"}}),n("div",e({style:I.mrEscalationFieldText},{children:Oe}))]})),n("div",e({style:I.mrEscalationFieldGroupSmall},{children:n(w,{value:t.escalation_reminder_frequency,onChange:function(e){return function(e,i){ai(e,"escalation_reminder_frequency",i)}(r,e)},options:je,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))}),t.id||r)})}))}))}))]})),Ke&&i(C.div,e({initial:{width:ni?"345px":"43px"},animate:{width:ni?"345px":"43px"},transition:{duration:.3},style:I.mrCalendarPanel},{children:[ni?n(S,{assignees:N}):n("div",e({style:I.mrCalendarCollapsed},{children:n(u,{style:I.mrIconCalendar})})),i("button",e({onClick:function(){return ti(function(e){return!e})},style:I.mrCalendarToggle},{children:[n("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50",fill:"none"},{children:n("path",{d:"M3.94434 9.65137C1.79601 11.031 0.49707 13.4087 0.49707 15.9619V35.1436C0.49707 37.8496 1.95476 40.346 4.31152 41.6758L17.5469 49.1426V0.915039L3.94434 9.65137Z",fill:"white",stroke:"#E0E0E0"})})),n(ni?m:v,{style:I.mrIconChevronToggle})]}))]}))]}))]}))};export{Y as ManageReminders};
|
|
1
|
+
import{__assign as e}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as n}from"react/jsx-runtime";import{useState as t,useEffect as r}from"react";import{Send as o,ChevronDown as l,CircleCheckBigIcon as d,Mail as a,InfoIcon as s,ArrowRight as c,CalendarIcon as u,ChevronRight as m,ChevronLeft as v}from"lucide-react";import h from"@mui/material/Checkbox";import{Chip as y,Box as p,Autocomplete as f,TextField as g}from"@mui/material";import{useDragControls as b,AnimatePresence as x,motion as C,Reorder as F}from"framer-motion";import k from"@mui/icons-material/DragIndicator";import{LocalizationProvider as D,DatePicker as R}from"@mui/x-date-pickers";import{AdapterDayjs as E}from"@mui/x-date-pickers/AdapterDayjs";import w from"./components/ReminderFrequencyAutocomplete.js";import S from"./components/AssigneeCalendarView.js";import _ from"dayjs";import{styles as I}from"./styles/ManageReminder.style.js";var A=["Assignee 1","Assignee 2","Assignee 3"],B=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],T=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],L=[{id:"1",name:"Assignee 1",color:"#C11574",bg:"#FDF2F8",startDate:new Date("2026-11-09"),dueDate:new Date("2026-12-01")},{id:"2",name:"Assignee 2",color:"#3538CD",bg:"#EEF4FF",startDate:new Date("2026-11-21"),dueDate:new Date("2026-12-03")},{id:"3",name:"Assignee 3",color:"#FF6058",bg:"#FFF7ED",startDate:new Date("2026-12-01"),dueDate:new Date("2026-12-03")}],P=[{bg:"#DBEAFE",text:"#1E40AF"},{bg:"#CCFBF1",text:"#0D9488"},{bg:"#DCFCE7",text:"#166534"}],O=[{initials:"OR",name:"Olivia Rhye",checked:!1,bg:"#DBEAFE",text:"#1D4ED8"},{initials:"DM",name:"Daniela Mark",checked:!1,bg:"#CFFAFE",text:"#0F766E"},{initials:"JB",name:"Jenna Beckner",checked:!1,bg:"#D1FAE5",text:"#059669"}],M=function(e){var i,n,t,r,o,l,d,a;return(null==e?void 0:e.is_escalation_reminder)&&(null===(i=null==e?void 0:e.days)||void 0===i?void 0:i.value)&&"undefined"!==(null===(n=null==e?void 0:e.days)||void 0===n?void 0:n.value)&&(null===(t=null==e?void 0:e.escalation_reminder_frequency)||void 0===t?void 0:t.value)&&"undefined"!==(null===(r=null==e?void 0:e.escalation_reminder_frequency)||void 0===r?void 0:r.value)?"Start notifying ".concat((null===(o=null==e?void 0:e.days)||void 0===o?void 0:o.value.includes("day"))?null===(l=null==e?void 0:e.days)||void 0===l?void 0:l.value:"".concat(null===(d=null==e?void 0:e.days)||void 0===d?void 0:d.value," ").concat(1===Number(null===(a=null==e?void 0:e.days)||void 0===a?void 0:a.value)?"day":"days")," ").concat(null==e?void 0:e.before_or_after," the due date"):"Notify until successful document upload"},q={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}},Y=function(Y){var j=Y.data,N=Y.schedules,H=Y.setSchedules,z=Y.remainderOwners,W=Y.setRemainderOwners,G=Y.labels,V=void 0===G?A:G,U=Y.colors,J=void 0===U?B:U,Z=Y.chipColor,K=void 0===Z?T:Z,Q=Y.assignees,X=void 0===Q?L:Q,$=Y.fallbackRecipients,ee=void 0===$?O:$,ie=Y.recipientsColor,ne=void 0===ie?P:ie,te=Y.manualReminderTitle,re=void 0===te?"Send Manual Reminder Now":te,oe=Y.manualReminderDescription,le=void 0===oe?"Immediately notify the assignees about this document.":oe;Y.lastReminderText;var de=Y.selectRecipientsLabel,ae=void 0===de?"Select recipients:":de,se=Y.previewEmailButtonLabel,ce=void 0===se?"Preview Email":se,ue=Y.sendNowButtonLabel,me=void 0===ue?"Send Now":ue,ve=Y.reminderSuccessTitle,he=void 0===ve?"Reminder sent successfully!":ve,ye=Y.reminderSuccessDescription,pe=void 0===ye?"Email notification sent to assignees.":ye,fe=Y.escalationTitle,ge=void 0===fe?"Escalation and Auto Reminder Setup":fe;Y.escalationTitleTooltip;var be=Y.escalationDescription,xe=void 0===be?"Configure Auto reminder settings for all assignees.":be;Y.configureAutoReminderText;var Ce=Y.getDynamicStatement,Fe=void 0===Ce?M:Ce,ke=Y.reminderStartDateLabel,De=void 0===ke?"Reminder Start Date":ke,Re=Y.documentDueDateLabel,Ee=void 0===Re?"Document Due Date":Re,we=Y.reminderFrequencyLabel,Se=void 0===we?"Reminder Frequency":we,_e=Y.escalationRemindersLabel,Ie=void 0===_e?"Escalation Reminders":_e;Y.escalationTooltip;var Ae=Y.escalationConditionText,Be=void 0===Ae?"If the document is still pending, start escalation reminders":Ae,Te=Y.daysText,Le=void 0===Te?"days":Te,Pe=Y.dueDataAndRepeatText,Oe=void 0===Pe?"due date and repeat every":Pe,Me=Y.reminderFrequencyOptions,qe=void 0===Me?["12 hours","24 hours","48 hours","72 hours","Custom"]:Me,Ye=Y.escalationFrequencyOptions,je=void 0===Ye?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:Ye,Ne=Y.beforeAfterOptions,He=void 0===Ne?["After","Before"]:Ne,ze=Y.handelSendNow,We=Y.showPreviewEmail,Ge=void 0===We||We,Ve=t(!1),Ue=Ve[0],Je=Ve[1],Ze=t(!1),Ke=Ze[0],Qe=Ze[1],Xe=t(!1),$e=Xe[0],ei=Xe[1],ii=t(!0),ni=ii[0],ti=ii[1],ri=t(ee),oi=ri[0],li=ri[1],di=b(),ai=function(i,n,t){W(function(r){return r.map(function(r,o){var l;return o===i?e(e({},r),((l={})[n]=t,l)):r})})},si=function(e,i){ai(e,"reminder_start_date",i)},ci=function(e){var i;if(!e)return null;if("custom"===e.type)return Number(e.value)<=0?null:60*Number(e.value)*60*1e3;return null!==(i={"1/2 hour":18e5,"1 hour":36e5,"4 hours":144e5,"6 hours":216e5,"12 hours":432e5,"24 hours":864e5,"48 hours":1728e5,"72 hours":2592e5,"96 hours":3456e5,"1/2 day":432e5,"1 day":864e5,"2 days":1728e5,"3 days":2592e5,"4 days":3456e5}[e.value])&&void 0!==i?i:null},ui=function(e,i,n){if(!e||!n)return[];var t=ci(n);if(!t||t<=0)return[];for(var r=[],o=_(e).valueOf(),l=i?_(i).valueOf():_(e).add(45,"day").valueOf(),d=0;o<=l&&d<150;)r.push(_(o).toISOString()),o+=t,d++;return r},mi=function(e,i,n,t){if(!(e&&i&&t&&n))return[];var r=ci(t);if(!r)return[];var o,l=_(e),d="custom"===i.type?Number(i.value):Number("1/2"===i.value.split(" ")[0]?.5:Number(i.value.split(" ")[0])),a=[];switch(n){case"Before":o=l.subtract(d,"day");break;case"After":o=l.add(d,"day");break;default:return[]}for(var s=o.valueOf(),c=0;c<150;c++)a.push(_(s).toISOString()),s+=r;return a},vi=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};r(function(){var e=(null==j?void 0:j.due_at)||"",i=Object.values((null==j?void 0:j.assignee)||{}),n=null==z?void 0:z.map(function(n,t){var r,o=i[t]||X.find(function(e){return e.id===String(n.id)}),l=(null===(r=null==J?void 0:J[t%J.length])||void 0===r?void 0:r.text)||"#C11574";return{ownerId:n.id||t+1,ownerName:(null==o?void 0:o.name)||n.name,ownerColor:(null==o?void 0:o.color)||l,reminders:ui(n.reminder_start_date,e,n.reminder_frequency),escalations:mi(e,n.days,n.before_or_after,n.escalation_reminder_frequency)}});H(n)},[z,null==j?void 0:j.due_at,null==j?void 0:j.assignee]),r(function(){(null==j?void 0:j.assignee)&&li(function(e){var i=Object.values(j.assignee).filter(function(e){return e&&Object.keys(e).length>0}).map(function(i,n){var t=e.find(function(e){return e.name===i.name});return{name:i.name,checked:!!t&&t.checked,recipientsColor:(null==ne?void 0:ne[n])||P[n%P.length]}});return i.length>0?i:ee})},[null==j?void 0:j.assignee,null==j?void 0:j.due_at]);var hi=Object.values((null==j?void 0:j.assignee)||{}).filter(function(e){return null==e?void 0:e.name});return i("div",e({style:e(e({},I.mrContainer),{width:"100%",minWidth:"850px"})},{children:[i("div",e({style:I.mrSectionBox},{children:[i("div",e({style:e(e({},I.mrSectionHeader),{cursor:"pointer"}),onClick:function(){Ue||Je(!0)}},{children:[i("div",e({style:I.mrSectionHeaderContent},{children:[i("div",e({style:I.mrSectionHeaderLeft},{children:[i("div",e({style:I.mrSectionTitleWrapper},{children:[n("div",e({style:I.mrSectionTitleIcon},{children:n(o,{style:I.mrIconSmall})})),n("div",e({style:I.mrSectionTitle},{children:re}))]})),n("div",e({style:I.mrSectionDescription},{children:le}))]})),n("div",e({style:I.mrSectionHeaderRight},{children:n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Je(function(e){return!e})},style:I.mrChevronButton},{children:n(l,{style:e(e({},I.mrChevronIcon),Ue?I.mrChevronRotated:{})})}))}))]})),n(x,{children:$e&&i(C.div,e({initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:I.mrSuccessMessage},{children:[n("div",e({style:I.mrSuccessIcon},{children:n("div",e({style:I.mrSuccessIconInner},{children:n(d,{style:I.mrIconSuccess})}))})),i("div",e({style:I.mrSuccessText},{children:[n("div",e({style:I.mrSuccessTitle},{children:he})),n("div",e({style:I.mrSuccessDescription},{children:pe}))]}))]}))})]})),n(x,{children:Ue&&i(C.div,e({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:e(e({},I.mrHiddenSection),{pointerEvents:Ue?"auto":"none"})},{children:[i("div",e({style:I.mrRecipientsSection},{children:[n("div",e({style:I.mrRecipientsLabel},{children:ae})),n("div",e({style:I.mrRecipientsGrid},{children:oi.map(function(t,r){var o,l,d,a,s=(null===(o=null==t?void 0:t.recipientsColor)||void 0===o?void 0:o.bg)||(null==t?void 0:t.bg)||(null===(l=P[r%P.length])||void 0===l?void 0:l.bg)||"#DBEAFE",c=(null===(d=null==t?void 0:t.recipientsColor)||void 0===d?void 0:d.text)||(null==t?void 0:t.text)||(null===(a=P[r%P.length])||void 0===a?void 0:a.text)||"#1E40AF";return i("div",e({style:I.mrRecipientItem},{children:[n(h,{checked:t.checked,onChange:function(){return i=t.name,void li(function(n){return n.map(function(n){return n.name===i?e(e({},n),{checked:!n.checked}):n})});var i},onClick:function(e){return e.stopPropagation()},size:"small",disableRipple:!0,icon:n("div",{style:I.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:I.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:I.mrCheckboxIcon},{children:n("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),i("div",e({style:I.mrRecipientInfo},{children:[n("div",e({style:e(e({},I.mrRecipientAvatar),{backgroundColor:s,color:c})},{children:vi(t.name)})),n("div",e({style:I.mrRecipientName},{children:t.name}))]}))]}),t.name)})}))]})),i("div",e({style:I.mrActionsSection},{children:[Ge&&i("button",e({onClick:function(e){e.stopPropagation()},type:"button",style:e(e({},I.mrActionButton),I.mrActionButtonSecondary)},{children:[n(a,{style:I.mrIconAction}),ce]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),ei(!0),setTimeout(function(){return ei(!1)},3e3);var i=oi.filter(function(e){return e.checked});ze(N,z.filter(function(e){return i.some(function(i){return i.id===e.id})}))},style:e(e({},I.mrActionButton),I.mrActionButtonPrimary)},{children:me}))]}))]}))})]})),i("div",e({style:I.mrMainContent},{children:[i("div",e({style:I.mrEscalationContainer},{children:[i("div",e({style:I.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Ke||Qe(!0)}},{children:[i("div",e({style:I.mrEscalationHeader},{children:[i("div",e({style:I.mrEscalationTitleWrapper},{children:[n("div",e({style:I.mrEscalationTitleText},{children:ge})),n("div",e({style:I.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:I.mrIconInfo})}))]})),i("div",e({style:I.mrEscalationActions},{children:[Ge&&i("button",e({style:I.mrEscalationPreviewButton},{children:[n("div",e({style:I.mrEscalationPreviewIcon},{children:n(a,{style:I.mrIconPreview})})),n("span",e({style:I.mrEscalationPreviewText},{children:ce}))]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Qe(function(e){return!e})},style:I.mrChevronButton},{children:n(l,{style:e(e({},I.mrChevronIcon),Ke?I.mrChevronRotated:{})})}))]}))]})),n("div",e({style:I.mrEscalationDescription},{children:xe}))]})),n(x,e({initial:!1},{children:Ke&&n(C.div,e({layout:!0,initial:{opacity:0,scaleY:.96},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:.96},transition:{duration:.3,ease:"easeInOut"},style:{transformOrigin:"top",overflow:"hidden"}},{children:n(F.Group,e({axis:"y",values:z||[],onReorder:function(e){W(e)},layoutScroll:!0,style:I.mrReorderGroup},{children:null==z?void 0:z.map(function(t,r){var o,d,a,u,m=hi[r]||ee[r],v=(null===(o=null==J?void 0:J[r])||void 0===o?void 0:o.bg)||"#FDF2FA",b=(null===(d=null==J?void 0:J[r])||void 0===d?void 0:d.text)||"#C11574",S=(null===(a=null==K?void 0:K[r])||void 0===a?void 0:a.bg)||"transparent",A=(null===(u=null==K?void 0:K[r])||void 0===u?void 0:u.text)||"inherit";return n(F.Item,e({value:t,dragControls:di,layout:"position"},{children:i("div",e({style:I.mrReminderItem},{children:[n("div",e({style:I.mrReminderLabelBox},{children:n("div",e({style:I.mrReminderLabelInner},{children:n(y,{label:(null==V?void 0:V[r])||"Assignee ".concat(r+1),sx:{backgroundColor:v,minWidth:90,color:b,fontWeight:500}})}))})),i("div",e({style:I.mrReminderContent},{children:[n("div",e({style:I.mrDragHandle},{children:n(k,{onPointerDown:function(e){return di.start(e)},sx:{color:"#9e9e9e"}})})),n(p,e({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:I.mrReminderBox},{children:i("div",e({style:I.mrReminderFields},{children:[i("div",e({style:I.mrReminderHeader},{children:[i("div",e({style:I.mrReminderAssignee},{children:[n("div",e({style:I.mrReminderAvatar},{children:n("span",e({style:I.mrReminderInitials},{children:vi(null==m?void 0:m.name)}))})),n("span",e({style:I.mrReminderName},{children:null==m?void 0:m.name}))]})),n("div",e({style:e(e({},I.mrReminderStatement),{backgroundColor:S})},{children:n("span",e({style:e(e({},I.mrReminderStatementText),{color:A})},{children:Fe(t)}))}))]})),i("div",e({style:I.mrReminderDateFields},{children:[i("div",e({style:I.mrReminderField},{children:[n("p",e({style:I.mrReminderFieldLabel},{children:De})),i("div",e({style:I.mrReminderDatePicker},{children:[n(D,e({dateAdapter:E},{children:n(R,{value:t.reminder_start_date?_(t.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&_(e).isValid()){if(_(e).isBefore(_(),"day"))return;si(r,_(e).toISOString())}else si(r,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:q,placeholder:"MM/DD/YYYY"},openPickerButton:{id:"trial-start-date-picker-icon","data-testid":"trial-start-date-picker-icon",size:"small"},openPickerIcon:{sx:{fontSize:"14px"}}}})})),n(c,{style:I.mrIconArrow})]}))]})),i("div",e({style:I.mrReminderField},{children:[n("p",e({style:I.mrReminderFieldLabel},{children:Ee})),n("div",e({style:I.mrReminderDueDate},{children:(null==j?void 0:j.due_at)?_(j.due_at).format("MM/DD/YYYY"):""}))]})),i("div",e({style:I.mrReminderField},{children:[n("p",e({style:I.mrReminderFieldLabel},{children:Se})),i("div",e({style:I.mrReminderFrequency},{children:[n("span",e({style:I.mrReminderFrequencyText},{children:"Every"})),n(w,{value:t.reminder_frequency,onChange:function(e){return function(e,i){ai(e,"reminder_frequency",i)}(r,e)},options:qe,suffix:"hours"})]}))]}))]})),i("div",e({style:I.mrEscalationCheckbox},{children:[i("div",e({style:I.mrEscalationCheckboxHeader},{children:[n(h,{size:"small",disableRipple:!0,checked:t.is_escalation_reminder,onChange:function(e){return function(e,i){ai(e,"is_escalation_reminder",i),i||(ai(e,"days",{type:"preset",value:""}),ai(e,"escalation_reminder_frequency",{type:"preset",value:""}),ai(e,"before_or_after",""))}(r,e.target.checked)},icon:n("div",{style:I.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:I.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:I.mrCheckboxIcon},{children:n("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),Ie,n("div",e({style:I.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:I.mrIconInfo})}))]})),n(x,{children:t.is_escalation_reminder&&i(C.div,e({initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},style:I.mrEscalationContent},{children:[n("div",e({style:I.mrEscalationCondition},{children:Be})),i("div",e({style:I.mrEscalationFields},{children:[i("div",e({style:I.mrEscalationFieldGroup},{children:[n(w,{value:t.days,onChange:function(e){return function(e,i){ai(e,"days",i)}(r,e)}}),n("div",e({style:I.mrEscalationFieldText},{children:Le}))]})),i("div",e({style:e(e({},I.mrEscalationFieldGroup),I.mrEscalationFieldGroupLarge)},{children:[n(f,{size:"small",options:He,value:t.before_or_after,onChange:function(e,i){return function(e,i){ai(e,"before_or_after",i)}(r,i||"")},popupIcon:n(l,{style:I.mrIconDropdown}),slotProps:{paper:{sx:{"& .MuiAutocomplete-option":{fontSize:"12px",minHeight:"32px"}}},clearIndicator:{sx:{"& svg":{fontSize:12}}}},renderInput:function(i){return n(g,e({},i,{placeholder:"Select value",sx:q}))},sx:{width:"100%"}}),n("div",e({style:I.mrEscalationFieldText},{children:Oe}))]})),n("div",e({style:I.mrEscalationFieldGroupSmall},{children:n(w,{value:t.escalation_reminder_frequency,onChange:function(e){return function(e,i){ai(e,"escalation_reminder_frequency",i)}(r,e)},options:je,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))}),t.id||r)})}))}))}))]})),Ke&&i(C.div,e({initial:{width:ni?"345px":"43px"},animate:{width:ni?"345px":"43px"},transition:{duration:.3},style:I.mrCalendarPanel},{children:[ni?n(S,{assignees:N}):n("div",e({style:I.mrCalendarCollapsed},{children:n(u,{style:I.mrIconCalendar})})),i("button",e({onClick:function(){return ti(function(e){return!e})},style:I.mrCalendarToggle},{children:[n("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50",fill:"none"},{children:n("path",{d:"M3.94434 9.65137C1.79601 11.031 0.49707 13.4087 0.49707 15.9619V35.1436C0.49707 37.8496 1.95476 40.346 4.31152 41.6758L17.5469 49.1426V0.915039L3.94434 9.65137Z",fill:"white",stroke:"#E0E0E0"})})),n(ni?m:v,{style:I.mrIconChevronToggle})]}))]}))]}))]}))};export{Y as ManageReminders};
|
|
2
2
|
//# sourceMappingURL=ManageReminders.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as t}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useRef as a}from"react";import{DATE_PICKER_STYLES as n}from"../styles/AssignLevelsDatePickerStyles.js";var l=function(t){if(t){var e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return"".concat(e,"-").concat(r,"-").concat(a)}};function i(i){var o,
|
|
1
|
+
import{__assign as t}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useRef as a}from"react";import{DATE_PICKER_STYLES as n}from"../styles/AssignLevelsDatePickerStyles.js";var l=function(t){if(t){var e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return"".concat(e,"-").concat(r,"-").concat(a)}};function i(i){var o,u=i.value,c=i.onSet,s=i.minDate,p=i.maxDate,d=i.disabled,v=void 0!==d&&d,m=a(null),f=l(null!=s?s:new Date),g=l(p);return e("div",t({style:t(t({},n.wrapper),{cursor:v?"not-allowed":n.wrapper.cursor,opacity:v?.65:1}),onClick:function(){var t,e;v||null===(e=null===(t=m.current)||void 0===t?void 0:t.showPicker)||void 0===e||e.call(t)}},{children:[r("span",t({style:n.placeholder},{children:u?u.toLocaleDateString("en-GB"):"--/--/----"})),r("input",{ref:m,type:"date",max:g,min:f,style:n.input,value:null!==(o=l(u))&&void 0!==o?o:"",disabled:v,onChange:function(t){if(!v){var e=t.target.value;c(e?function(t){var e=t.split("-").map(Number),r=e[0],a=e[1],n=e[2];return r&&a&&n?new Date(r,a-1,n,12,0,0,0):null}(e):null)}}})]}))}export{i as default};
|
|
2
2
|
//# sourceMappingURL=AssignLevelsDatePicker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as n}from"react/jsx-runtime";import r,{useRef as o}from"react";import{Calendar as i}from"lucide-react";var a=function(t){var e=t.split("-"),n=e[0],r=e[1],o=e[2];return n&&r&&o?"".concat(o,"/").concat(r,"/").concat(n):t};function l(l){var c=l.value,d=l.onChange,u=l.placeholder,p=void 0===u?"dd/mm/yyyy":u,s=l.disabled,v=void 0!==s&&s,g=l.minDate,m=o(null),f=r.useMemo(function(){var t=null!=g?g:new Date,e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return"".concat(e,"-").concat(n,"-").concat(r)},[g]);return e("div",t({onClick:function(){var t,e;v||null===(e=null===(t=m.current)||void 0===t?void 0:t.showPicker)||void 0===e||e.call(t)},style:{position:"relative",width:"100%",height:"35px",padding:"0 12px",borderRadius:"12px",background:"#F3F4F6",border:"1px solid #C7CDD5",display:"flex",gap:60,alignItems:"center",cursor:v?"not-allowed":"pointer",opacity:v?.65:1,boxSizing:"border-box"}},{children:[n("input",{ref:m,type:"date",value:c,onChange:function(t){return d(t.target.value?function(t){var e=t.split("-").map(Number),n=e[0],r=e[1],o=e[2];return n&&r&&o?new Date(n,r-1,o,12,0,0,0):null}(t.target.value):null)},min:f,disabled:v,style:{position:"absolute",opacity:0,pointerEvents:"none"}}),n("span",t({style:{fontSize:"14px",fontWeight:400,color:c?"#111827":"#667085"}},{children:c?a(c):p})),n("div",t({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"6px"}},{children:n(i,{size:18,color:"#667085",strokeWidth:2})}))]}))}export{l as default};
|
|
2
2
|
//# sourceMappingURL=CustomDatePicker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as l,jsx as n,Fragment as t}from"react/jsx-runtime";import i from"react";import{Info as o,Check as r,Hourglass as d,X as s,CircleCheck as a,MinusCircle as p,User as c,ArrowRight as v,CheckCircle as g,FileCheck as u,LucidePen as x}from"lucide-react";import{DEFAULT_REVIEW_STATUS_STYLES as f}from"../styles/ReviewStatusStyles.js";var h=function(e){var l=e.trim().split(/\s+/);return 1===l.length?l[0].slice(0,2).toUpperCase():(l[0][0]+l[l.length-1][0]).toUpperCase()},y=function(e){for(var l=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],n=0,t=0;t<e.length;t++)n=e.charCodeAt(t)+((n<<5)-n);return l[Math.abs(n)%l.length]},F=function(e){var l=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof l&&l.trim()?l:"No role assigned"},m=function(e){return!0===e||("string"==typeof e?["approved","completed","complete","done","accepted"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(m(e.approved)||m(e.status)||m(e.action)||m(e.value)))},b=function(e){return"string"==typeof e?["rejected","declined","denied"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(b(e.rejected)||b(e.status)||b(e.action)||b(e.value))};function E(t){var r=t.levels,d=t.reviewData,s=void 0===d?{}:d,a=t.showApproveAndMoveToNextLevelButton,p=void 0!==a&&a,c=t.onApproveAndMoveToNextLevel,v=r.map(function(e,l){var n,t,i,o,r,d,a,p,c=null!==(a=null!==(i=null!==(t=null!==(n=s[l])&&void 0!==n?n:s[e.headerName])&&void 0!==t?t:s[e.title])&&void 0!==i?i:e.isHidden?null!==(d=null!==(r=null!==(o=s.final)&&void 0!==o?o:s.Final)&&void 0!==r?r:s.finalApproval)&&void 0!==d?d:s.final_approval:void 0)&&void 0!==a?a:{},v=c&&"object"==typeof c?c:{},g=(null!==(p=e.assignees)&&void 0!==p?p:[]).map(function(l){var n,t,i,o,r,d,s=null!==(t=null!==(n=v[String(l.id)])&&void 0!==n?n:v[String(l.email)])&&void 0!==t?t:e.isHidden?null!==(d=null!==(r=null!==(o=null!==(i=v.owner)&&void 0!==i?i:v.final)&&void 0!==o?o:v.finalApproval)&&void 0!==r?r:v.final_approval)&&void 0!==d?d:c:void 0;return{user:l,approved:m(s)||m(l.action)||m(l.status)||m(l.approved)||m(l.isApproved),rejected:b(s)||b(l.action)||b(l.status)||b(l.rejected)||b(l.isRejected)}}),u="not_started";if(m(c)||m(e.isApproved)||m(e.approved))u="approved";else if(b(c)||b(e.isRejected)||b(e.rejected))u="rejected";else if(m(e.status))u="approved";else if(b(e.status))u="rejected";else{var x=g.length>0&&g.every(function(e){return e.approved}),f=g.some(function(e){return e.rejected});x?u="approved":f&&(u="rejected")}return{level:e,assigneeStatuses:g,status:u}}),g=!1,u=v.map(function(l){var n="waiting",t=!0===l.level.isHidden;return"approved"===l.status?n="approved":"rejected"===l.status?(n="rejected",g=!0):l.level.isMandatory||t?g||(n="pending",g=!0):n="optional",e(e({},l),{extendedStatus:n,isFinalApproval:t})}),x=function(e){return e.filter(function(e){return"approved"===e.status}).length}(v),h=v.length;return l("div",e({style:{display:"flex",flexDirection:"column",gap:24}},{children:[l("div",{children:[l("div",e({style:f.progressHeader},{children:[n("span",e({style:f.progressTitle},{children:"Approval Progress"})),l("span",e({style:f.progressCount},{children:[x," of ",h," level",1!==h?"s":""," complete"]}))]})),n("div",e({style:f.progressBarTrack},{children:u.map(function(l,t){var i,o="approved"===l.extendedStatus,r="rejected"===l.extendedStatus,d="optional"===l.extendedStatus,s=0===t,a=t===h-1;return!(null===(i=l.level)||void 0===i?void 0:i.assignees)||!Array.isArray(l.level.assignees)||l.level.assignees.length<1?null:n("div",{style:e(e({},f.progressSegment),{backgroundColor:o?"#6366F1":r?"#EF4444":d?"#F1F5F9":"#E5E7EB",borderRadius:s&&a?"999px":s?"999px 0 0 999px":a?"0 999px 999px 0":"0",marginRight:a?0:3})},t)})})),n("div",e({style:f.progressLabels},{children:u.map(function(l,t){return n("span",e({style:e(e({},f.progressLabel),{color:"approved"===l.extendedStatus?"#6366F1":"rejected"===l.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===l.extendedStatus||"rejected"===l.extendedStatus?600:400})},{children:l.level.assignees&&l.level.assignees.length>0?"".concat(l.level.headerName," - ").concat(l.level.title):""}),t)})}))]}),l("div",e({style:{display:"flex",flexDirection:"column",gap:0}},{children:[n("div",e({style:f.sectionHeadingRow},{children:l("div",e({style:{display:"flex",alignItems:"center",gap:6}},{children:[n("span",e({style:f.sectionTitle},{children:"Approval Levels"})),n(o,{size:15,color:"#9CA3AF"})]}))})),n("div",e({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:u.map(function(t,o){var r,d,s=o===u.length-1,a=t.isFinalApproval,v=u[o+1],g=null==v?void 0:v.isFinalApproval,x=v&&!v.level.isMandatory&&!g;return l(i.Fragment,a?{children:[l("div",e({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),n("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),n("div",e({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),n(A,{reviewLevel:t})]}:{children:[n(C,{reviewLevel:t,levelIndex:o,nextLevel:null!==(r=null==v?void 0:v.level)&&void 0!==r?r:null,showApproveAndMoveToNextLevelButton:p,onApproveAndMoveToNextLevel:c}),!s&&!g&&v.level.assignees&&(null===(d=v.level.assignees)||void 0===d?void 0:d.length)>0&&l("div",e({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),n("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:x?"optional":"then"})),n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},o)})}))]})),n(j,{levels:r})]}))}function C(t){var i,a=t.reviewLevel,p=t.levelIndex,c=t.nextLevel,v=t.showApproveAndMoveToNextLevelButton,g=t.onApproveAndMoveToNextLevel,u=a.level,x=a.assigneeStatuses,f=a.extendedStatus,h=v&&"pending"===f&&!!g,y=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:n(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:n(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:n(s,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:n(o,{size:14}),text:"Optional"}}[f])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},F="approved"===f?"1px solid #D1FAE5":"rejected"===f?"1px solid #FCA5A5":"optional"===f?"1px dashed #CBD5E1":"1px solid #E5E7EB",m="approved"===f?"#F0FDF4":"rejected"===f?"#FEF2F2":"#F8FAFC";return!u.assignees||!Array.isArray(u.assignees)||u.assignees.length<1?null:l("div",e({style:{backgroundColor:"#FFFFFF",border:F,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[l("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:m,borderBottom:F,padding:"12px 16px"}},{children:[l("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[n(S,{name:u.headerName}),n("span",e({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:u.title}))]})),l("div",e({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[h&&l("button",e({type:"button",onClick:function(){return null==g?void 0:g({level:u,levelIndex:p,nextLevel:c})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[n(r,{size:13}),"Approve & Move to Next Level"]})),l("div",e({style:{backgroundColor:y.bg,color:y.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[y.icon,y.text]}))]}))]})),n("div",e({style:{padding:"16px"}},{children:x.length>0?n("div",e({style:{display:"flex",flexDirection:"column",gap:16}},{children:x.map(function(e,l){var t;return n(z,{assigneeStatus:e,extendedStatus:f},null!==(t=e.user.id)&&void 0!==t?t:l)})})):n("div",e({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function A(t){var i,a,p,c,v=t.reviewLevel,g=v.assigneeStatuses,u=v.extendedStatus,x=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:n(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:n(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:n(s,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:n(o,{size:14}),text:"Optional"}}[u])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},f=null===(a=g[0])||void 0===a?void 0:a.user;null==f||f.email;var m=F(f);return l("div",e({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[f?l("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[n("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:y(null!==(p=f.id)&&void 0!==p?p:f.name).bg,color:y(null!==(c=f.id)&&void 0!==c?c:f.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:h(f.name)})),l("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[n("span",e({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:f.name})),l("span",e({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",m]})),n("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):n("span",e({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),l("div",e({style:{backgroundColor:x.bg,color:x.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[x.icon,x.text]}))]}))}function z(i){var o,r=i.assigneeStatus,d=i.extendedStatus,c=r.user,v=r.approved||"approved"===c.action,g=r.rejected||"rejected"===c.action,u=h(c.name),x=y(null!==(o=c.id)&&void 0!==o?o:c.name),f=F(c);return l("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[l("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[n("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:x.bg,color:x.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:u})),l("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[l("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[n("span",e({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:c.name})),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:f}))]})),n("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:c.email}))]}))]})),n("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:v?n(a,{size:20,color:"#16A34A",strokeWidth:1.5}):g?n(s,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===d?l(t,{children:[n("span",{style:{fontSize:"13px",color:"#4B5563"}}),n(p,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):n(p,"optional"===d?{size:20,color:"#CBD5E1",strokeWidth:1.5}:{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function S(l){var t=l.name,i=y(t);return n("span",e({style:{backgroundColor:i.bg,color:i.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:t}))}var B=function(e){switch(e){case 0:return n(x,{size:16,color:"#475569"});case 1:return n(u,{size:16,color:"#475569"});case 2:return n(c,{size:16,color:"#475569"});default:return n(g,{size:16,color:"#475569"})}};function j(t){var o=t.levels.filter(function(e){var l,n;return(null!==(n=null===(l=e.assignees)||void 0===l?void 0:l.length)&&void 0!==n?n:0)>0});return l("div",e({style:f.flowBox},{children:[n("span",e({style:f.flowTitle},{children:"Current Approval Flow"})),o.length>0?n("div",e({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:o.map(function(t,r){var d,s=t.isHidden,a=!t.isMandatory&&!s,p=s?n(c,{size:16,color:"#475569"}):B(r);return l(i.Fragment,{children:[l("span",e({style:e(e({},f.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:a?"1px dashed #CBD5E1":void 0})},{children:[p,l("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[t.assignees.map(function(t,o){var r,d,s=F(t);return l(i.Fragment,{children:[o>0&&n("span",e({style:{color:"#9CA3AF"}},{children:"/"})),l("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n("span",e({style:{fontSize:13,color:a?"#64748B":"#374151"}},{children:t.name})),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:s}))]}))]},null!==(d=null!==(r=t.id)&&void 0!==r?r:t.email)&&void 0!==d?d:o)}),a&&n("span",e({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<o.length-1&&n(v,{size:16,color:"#9CA3AF"})]},null!==(d=t.id)&&void 0!==d?d:"".concat(t.headerName,"-").concat(r))})})):n("p",e({style:f.flowEmpty},{children:"No owners assigned yet."}))]}))}export{E as default};
|
|
1
|
+
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as n,jsx as l,Fragment as t}from"react/jsx-runtime";import i from"react";import{Info as o,Check as r,Hourglass as d,X as a,CircleCheck as s,MinusCircle as p,User as c,ArrowRight as v,CheckCircle as g,FileCheck as u,LucidePen as x}from"lucide-react";import{DEFAULT_REVIEW_STATUS_STYLES as f}from"../styles/ReviewStatusStyles.js";var h=function(e){var n=e.trim().split(/\s+/);return 1===n.length?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()},y=function(e){for(var n=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],l=0,t=0;t<e.length;t++)l=e.charCodeAt(t)+((l<<5)-l);return n[Math.abs(l)%n.length]},F=function(e){var n=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof n&&n.trim()?n:"No role assigned"},m=function(e){return!0===e||("string"==typeof e?["approved","completed","complete","done","accepted"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(m(e.approved)||m(e.status)||m(e.action)||m(e.value)))},b=function(e){return"string"==typeof e?["rejected","declined","denied"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(b(e.rejected)||b(e.status)||b(e.action)||b(e.value))};function E(t){var r=t.levels,d=t.reviewData,a=void 0===d?{}:d,s=t.showApproveAndMoveToNextLevelButton,p=void 0!==s&&s,c=t.onApproveAndMoveToNextLevel,v=r.map(function(e,n){return{level:e,originalLevelIndex:n}}).filter(function(e){return function(e){var n=null==e?void 0:e.assignees;return Array.isArray(n)&&n.length>0}(e.level)}),g=v.map(function(e,n){var l,t,i,o,r,d,s,p,c,v=e.level,g=e.originalLevelIndex,u=null!==(p=null!==(o=null!==(i=null!==(t=null!==(l=a[g])&&void 0!==l?l:a[n])&&void 0!==t?t:a[v.headerName])&&void 0!==i?i:a[v.title])&&void 0!==o?o:v.isHidden?null!==(s=null!==(d=null!==(r=a.final)&&void 0!==r?r:a.Final)&&void 0!==d?d:a.finalApproval)&&void 0!==s?s:a.final_approval:void 0)&&void 0!==p?p:{},x=u&&"object"==typeof u?u:{},f=(null!==(c=v.assignees)&&void 0!==c?c:[]).map(function(e){var n,l,t,i,o,r,d=null!==(l=null!==(n=x[String(e.id)])&&void 0!==n?n:x[String(e.email)])&&void 0!==l?l:v.isHidden?null!==(r=null!==(o=null!==(i=null!==(t=x.owner)&&void 0!==t?t:x.final)&&void 0!==i?i:x.finalApproval)&&void 0!==o?o:x.final_approval)&&void 0!==r?r:u:void 0;return{user:e,approved:m(d)||m(e.action)||m(e.status)||m(e.approved)||m(e.isApproved),rejected:b(d)||b(e.action)||b(e.status)||b(e.rejected)||b(e.isRejected)}}),h="not_started";if(m(u)||m(v.isApproved)||m(v.approved))h="approved";else if(b(u)||b(v.isRejected)||b(v.rejected))h="rejected";else if(m(v.status))h="approved";else if(b(v.status))h="rejected";else{var y=f.length>0&&f.every(function(e){return e.approved}),F=f.some(function(e){return e.rejected});y?h="approved":F&&(h="rejected")}return{level:v,assigneeStatuses:f,status:h,originalLevelIndex:g}}),u=!1,x=g.map(function(n){var l="waiting",t=!0===n.level.isHidden;return"approved"===n.status?l="approved":"rejected"===n.status?(l="rejected",u=!0):n.level.isMandatory||t?u||(l="pending",u=!0):l="optional",e(e({},n),{extendedStatus:l,isFinalApproval:t})}),h=function(e){return e.filter(function(e){return"approved"===e.status}).length}(g),y=g.length;return n("div",e({style:{display:"flex",flexDirection:"column",gap:24}},{children:[n("div",{children:[n("div",e({style:f.progressHeader},{children:[l("span",e({style:f.progressTitle},{children:"Approval Progress"})),n("span",e({style:f.progressCount},{children:[h," of ",y," level",1!==y?"s":""," complete"]}))]})),l("div",e({style:f.progressBarTrack},{children:x.map(function(n,t){var i="approved"===n.extendedStatus,o="rejected"===n.extendedStatus,r="optional"===n.extendedStatus,d=0===t,a=t===y-1;return l("div",{style:e(e({},f.progressSegment),{backgroundColor:i?"#6366F1":o?"#EF4444":r?"#F1F5F9":"#E5E7EB",borderRadius:d&&a?"999px":d?"999px 0 0 999px":a?"0 999px 999px 0":"0",marginRight:a?0:3})},t)})})),l("div",e({style:f.progressLabels},{children:x.map(function(n,t){return l("span",e({style:e(e({},f.progressLabel),{color:"approved"===n.extendedStatus?"#6366F1":"rejected"===n.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===n.extendedStatus||"rejected"===n.extendedStatus?600:400})},{children:n.level.assignees&&n.level.assignees.length>0?"".concat(n.level.headerName," - ").concat(n.level.title):""}),t)})}))]}),n("div",e({style:{display:"flex",flexDirection:"column",gap:0}},{children:[l("div",e({style:f.sectionHeadingRow},{children:n("div",e({style:{display:"flex",alignItems:"center",gap:6}},{children:[l("span",e({style:f.sectionTitle},{children:"Approval Levels"})),l(o,{size:15,color:"#9CA3AF"})]}))})),l("div",e({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:x.map(function(t,o){var r,d,a=o===x.length-1,s=t.isFinalApproval,v=x[o+1],g=null==v?void 0:v.isFinalApproval,u=v&&!v.level.isMandatory&&!g;return n(i.Fragment,s?{children:[n("div",e({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[l("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),l("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),l("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),l("div",e({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),l(A,{reviewLevel:t})]}:{children:[l(C,{reviewLevel:t,levelIndex:t.originalLevelIndex,nextLevel:null!==(r=null==v?void 0:v.level)&&void 0!==r?r:null,showApproveAndMoveToNextLevelButton:p,onApproveAndMoveToNextLevel:c}),!a&&!g&&v.level.assignees&&(null===(d=v.level.assignees)||void 0===d?void 0:d.length)>0&&n("div",e({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[l("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),l("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:u?"optional":"then"})),l("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},o)})}))]})),l(j,{levels:r})]}))}function C(t){var i,s=t.reviewLevel,p=t.levelIndex,c=t.nextLevel,v=t.showApproveAndMoveToNextLevelButton,g=t.onApproveAndMoveToNextLevel,u=s.level,x=s.assigneeStatuses,f=s.extendedStatus,h=v&&"pending"===f&&!!g,y=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:l(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:l(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:l(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:l(a,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:l(o,{size:14}),text:"Optional"}}[f])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:l(d,{size:14}),text:"Waiting"},F="approved"===f?"1px solid #D1FAE5":"rejected"===f?"1px solid #FCA5A5":"optional"===f?"1px dashed #CBD5E1":"1px solid #E5E7EB",m="approved"===f?"#F0FDF4":"rejected"===f?"#FEF2F2":"#F8FAFC";return!u.assignees||!Array.isArray(u.assignees)||u.assignees.length<1?null:n("div",e({style:{backgroundColor:"#FFFFFF",border:F,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[n("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:m,borderBottom:F,padding:"12px 16px"}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[l(S,{name:u.headerName}),l("span",e({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:u.title}))]})),n("div",e({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[h&&n("button",e({type:"button",onClick:function(){return null==g?void 0:g({level:u,levelIndex:p,nextLevel:c})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[l(r,{size:13}),"Approve & Move to Next Level"]})),n("div",e({style:{backgroundColor:y.bg,color:y.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[y.icon,y.text]}))]}))]})),l("div",e({style:{padding:"16px"}},{children:x.length>0?l("div",e({style:{display:"flex",flexDirection:"column",gap:16}},{children:x.map(function(e,n){var t;return l(z,{assigneeStatus:e,extendedStatus:f},null!==(t=e.user.id)&&void 0!==t?t:n)})})):l("div",e({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function A(t){var i,s,p,c,v=t.reviewLevel,g=v.assigneeStatuses,u=v.extendedStatus,x=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:l(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:l(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:l(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:l(a,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:l(o,{size:14}),text:"Optional"}}[u])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:l(d,{size:14}),text:"Waiting"},f=null===(s=g[0])||void 0===s?void 0:s.user;null==f||f.email;var m=F(f);return n("div",e({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[f?n("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[l("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:y(null!==(p=f.id)&&void 0!==p?p:f.name).bg,color:y(null!==(c=f.id)&&void 0!==c?c:f.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:h(f.name)})),n("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[l("span",e({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:f.name})),n("span",e({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",m]})),l("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):l("span",e({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),n("div",e({style:{backgroundColor:x.bg,color:x.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[x.icon,x.text]}))]}))}function z(i){var o,r=i.assigneeStatus,d=i.extendedStatus,c=r.user,v=r.approved||"approved"===c.action,g=r.rejected||"rejected"===c.action,u=h(c.name),x=y(null!==(o=c.id)&&void 0!==o?o:c.name),f=F(c);return n("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[l("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:x.bg,color:x.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:u})),n("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[l("span",e({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:c.name})),l("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:f}))]})),l("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:c.email}))]}))]})),l("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:v?l(s,{size:20,color:"#16A34A",strokeWidth:1.5}):g?l(a,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===d?n(t,{children:[l("span",{style:{fontSize:"13px",color:"#4B5563"}}),l(p,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):l(p,"optional"===d?{size:20,color:"#CBD5E1",strokeWidth:1.5}:{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function S(n){var t=n.name,i=y(t);return l("span",e({style:{backgroundColor:i.bg,color:i.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:t}))}var B=function(e){switch(e){case 0:return l(x,{size:16,color:"#475569"});case 1:return l(u,{size:16,color:"#475569"});case 2:return l(c,{size:16,color:"#475569"});default:return l(g,{size:16,color:"#475569"})}};function j(t){var o=t.levels.filter(function(e){var n,l;return(null!==(l=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==l?l:0)>0});return n("div",e({style:f.flowBox},{children:[l("span",e({style:f.flowTitle},{children:"Current Approval Flow"})),o.length>0?l("div",e({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:o.map(function(t,r){var d,a=t.isHidden,s=!t.isMandatory&&!a,p=a?l(c,{size:16,color:"#475569"}):B(r);return n(i.Fragment,{children:[n("span",e({style:e(e({},f.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:s?"1px dashed #CBD5E1":void 0})},{children:[p,n("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[t.assignees.map(function(t,o){var r,d,a=F(t);return n(i.Fragment,{children:[o>0&&l("span",e({style:{color:"#9CA3AF"}},{children:"/"})),n("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[l("span",e({style:{fontSize:13,color:s?"#64748B":"#374151"}},{children:t.name})),l("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:a}))]}))]},null!==(d=null!==(r=t.id)&&void 0!==r?r:t.email)&&void 0!==d?d:o)}),s&&l("span",e({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<o.length-1&&l(v,{size:16,color:"#9CA3AF"})]},null!==(d=t.id)&&void 0!==d?d:"".concat(t.headerName,"-").concat(r))})})):l("p",e({style:f.flowEmpty},{children:"No owners assigned yet."}))]}))}export{E as default};
|
|
2
2
|
//# sourceMappingURL=ReviewStatus.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},n=function(e){var n=new Date(e);return n.setHours(12,0,0,0),n},t=function(n){if(!n.dueDate)return null;var t=new Date(n.dueDate);return Number.isFinite(t.getTime())?e(t):null},r=function(e){return e.reduce(function(e,n){var r=t(n);return!r||e&&r<=e?e:r},null)},a=function(e){return e.reduce(function(e,n){var r=t(n);return!r||e&&r>=e?e:r},null)},u=function(n,r){var a=n.filter(function(e){return!e.isHidden}),u=e(new Date),i=r?new Date(r):null;if(i&&!Number.isFinite(i.getTime()))return"Final approval has an invalid due date";var l=i?e(i):null;if(l&&l<u)return"Final approval due date cannot be before today";for(var o=null,d=0,c=0;c<a.length;c+=1){var f=a[c];if(f.dueDate){var v=t(f);if(!v)return"Level ".concat(c+1," has an invalid due date");if(v<u)return"Level ".concat(c+1," due date cannot be before today");if(o&&v<o)return"Level ".concat(c+1," due date cannot be before Level ").concat(d," due date");if(l&&v>l)return"Level ".concat(c+1," due date cannot be after final approval due date");o=v,d=c+1}}return null};export{u as getApprovalDateValidationError,a as getEarliestLevelDueDate,r as getLatestLevelDueDate,n as normalizeApprovalDate,e as startOfCalendarDay};
|
|
2
|
+
//# sourceMappingURL=approvalDateValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvalDateValidation.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignReminderLevels.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/AssignReminderLevels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,yBAAyB,EAAS,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"AssignReminderLevels.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/AssignReminderLevels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,yBAAyB,EAAS,MAAM,eAAe,CAAC;AAoDjE,iBAAS,oBAAoB,CAAC,EAC1B,KAAK,EACL,MAAW,EACX,oBAA4B,EAC5B,cAAc,EACd,SAAS,EACT,uBAAuB,EACvB,UAAU,EACV,kBAAiD,EACjD,cAAc,EACd,iBAAiB,EACjB,YAAiB,EACjB,WAAW,EACX,oBAAoB,EACpB,aAAa,GAChB,EAAE,yBAAyB,qBA+W3B;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignReminderWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/AssignReminderWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AssignReminderWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/AssignReminderWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAWnD,OAAO,EACL,0BAA0B,EAC1B,KAAK,EAIN,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,cAAc,EAAE,KAAK,EAiBjC,CAAC;AAwLF,iBAAS,qBAAqB,CAAC,EAC7B,QAAa,EACb,UAAe,EACf,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,mCAAmC,EACnC,2BAA2B,EAC3B,WAAW,EACX,YAAiB,EACjB,QAAgB,EAChB,aAAkB,EAClB,sBAAsB,EACtB,OAAc,EAGd,eAAuB,EACvB,mBAA2B,EAC3B,eAAuB,EACvB,qBAA6B,EAC7B,iBAAyB,EACzB,0BAAkC,EAGlC,aAAa,EACb,eAAe,EAAE,mBAAmB,EACpC,kBAAkB,EAAE,sBAAsB,EAC1C,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,gBAAgB,EAC9B,aAAa,EACb,gBAAgB,EAChB,OAAO,EAGP,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,QAAQ,EACR,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,GACnB,EAAE,0BAA0B,qBA0vB5B;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageReminders.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/ManageReminders.tsx"],"names":[],"mappings":";AA2BA,OAAO,EACL,cAAc,EACd,mBAAmB,EAEnB,eAAe,EACf,WAAW,EACZ,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,mBAAmB,EAAE,CAAC;IACvC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAChC,KAAK,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC,CAC5C,CAAC;IAEF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;IAEhC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAEpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,MAAM,CAAC;IAEnE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,iBAAiB,CAAC,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B,aAAa,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,mBAAmB,EAAE,KAAK,IAAI,CAAC;IAClF,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAkFD,eAAO,MAAM,eAAe,stBAiDzB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ManageReminders.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/ManageReminders.tsx"],"names":[],"mappings":";AA2BA,OAAO,EACL,cAAc,EACd,mBAAmB,EAEnB,eAAe,EACf,WAAW,EACZ,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,mBAAmB,EAAE,CAAC;IACvC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAChC,KAAK,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC,CAC5C,CAAC;IAEF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;IAEhC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAEpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,MAAM,CAAC;IAEnE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,iBAAiB,CAAC,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B,aAAa,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,mBAAmB,EAAE,KAAK,IAAI,CAAC;IAClF,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAkFD,eAAO,MAAM,eAAe,stBAiDzB,oBAAoB,gCA0kBtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignLevelsDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/AssignLevelsDatePicker.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AssignLevelsDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/AssignLevelsDatePicker.tsx"],"names":[],"mappings":";AAmBA,iBAAS,qBAAqB,CAAC,EAC7B,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAgB,GACjB,EAAE;IACD,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAsCA;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/CustomDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAGtC,UAAU,qBAAqB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"CustomDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/CustomDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAGtC,UAAU,qBAAqB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB;AAsBD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,WAA0B,EAC1B,QAAgB,EAChB,OAAO,GACV,EAAE,qBAAqB,qBAmFvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReviewStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/ReviewStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAIH,iBAAiB,EAEpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReviewStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/ReviewStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAIH,iBAAiB,EAEpB,MAAM,gBAAgB,CAAC;AA0FxB,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACjC,MAAM,EACN,UAAe,EACf,mCAA2C,EAC3C,2BAA2B,GAC9B,EAAE,iBAAiB,qBAyPnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Level } from "../types/types";
|
|
2
|
+
export declare const startOfCalendarDay: (date: Date) => Date;
|
|
3
|
+
export declare const normalizeApprovalDate: (date: Date) => Date;
|
|
4
|
+
export declare const getLatestLevelDueDate: (levels: Level[]) => Date | null;
|
|
5
|
+
export declare const getEarliestLevelDueDate: (levels: Level[]) => Date | null;
|
|
6
|
+
export declare const getApprovalDateValidationError: (levels: Level[], finalApprovalDueDate: Date | null) => string | null;
|
|
7
|
+
//# sourceMappingURL=approvalDateValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvalDateValidation.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/utils/approvalDateValidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,eAAO,MAAM,kBAAkB,SAAU,IAAI,SAI5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,IAAI,SAI/C,CAAC;AASF,eAAO,MAAM,qBAAqB,WAAY,KAAK,EAAE,gBAKzC,CAAC;AAEb,eAAO,MAAM,uBAAuB,WAAY,KAAK,EAAE,gBAK3C,CAAC;AAEb,eAAO,MAAM,8BAA8B,WAC/B,KAAK,EAAE,wBACO,IAAI,GAAG,IAAI,kBA+CpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viswa-test/creative-workspace-ui-component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.72",
|
|
4
4
|
"author": "Viswa Koduru",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"start": "craco start",
|
|
27
|
+
"start": "PORT=3008 craco start",
|
|
28
28
|
"build": "rollup -c && npm run copy:styles",
|
|
29
29
|
"copy:styles": "mkdir -p dist/features/lsc-guidelines dist/cjs/features/lsc-guidelines && cp src/features/lsc-guidelines/theme.css dist/features/lsc-guidelines/theme.css && cp src/features/lsc-guidelines/theme.css dist/cjs/features/lsc-guidelines/theme.css",
|
|
30
30
|
"tsupBuild": "tsup src/index.ts",
|