@viswa-test/creative-workspace-ui-component 0.0.81 → 0.0.82
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/AssignReminderWrapper.js +1 -1
- package/dist/cjs/components/AssignReminders/ManageReminders.js +1 -1
- package/dist/components/AssignReminders/AssignReminderWrapper.js +1 -1
- package/dist/components/AssignReminders/ManageReminders.js +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/package.json +1 -1
|
@@ -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"),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 p(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})})},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(m(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,n,i){return(null==e?void 0:e.name)||(null==n?void 0:n.email)||(null==i?void 0:i.email)||"Owner"};exports.AssignReminderWrapper=function(u){var S,L,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,F=u.approvalDueDate,j=u.setApprovalDueDate,w=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.ownerDetails,Z=u.blockEditScreen,$=void 0!==Z&&Z,ee=u.hideManageReminders,ne=void 0!==ee&&ee,ie=u.hideClearButton,ae=void 0!==ie&&ie,te=u.hideSaveChangesButton,re=void 0!==te&&te,se=u.hideFooterActions,le=void 0!==se&&se;u.hideAssigneeApproverScreen,u.remindersData;var oe=u.remainderOwners,de=u.setRemainderOwners,ue=u.schedules,_e=u.setSchedules,ce=u.handelSendNow,ve=u.showPreviewEmail,fe=u.tabName,pe=u.reminderLabels,me=u.reminderColors,ge=u.reminderChipColor,Re=u.reminderAssignees,Se=u.reminderFallbackRecipients,De=u.reminderRecipientsColor,Ee=u.manualReminderTitle,Ae=u.manualReminderDescription,ye=u.lastReminderText,Le=u.selectRecipientsLabel,he=u.previewEmailButtonLabel,be=u.sendNowButtonLabel,Te=u.reminderSuccessTitle,Ne=u.reminderSuccessDescription,xe=u.escalationTitle,Ie=u.escalationTitleTooltip,Me=u.escalationDescription,Pe=u.configureAutoReminderText,Fe=u.getDynamicStatement,je=u.reminderStartDateLabel,we=u.documentDueDateLabel,qe=u.reminderFrequencyLabel,Ce=u.escalationRemindersLabel,Be=u.escalationTooltip,We=u.escalationConditionText,Ue=u.daysText,Ye=u.dueDataAndRepeatText,Ge=u.reminderFrequencyOptions,Oe=u.escalationFrequencyOptions,ke=u.beforeAfterOptions,He=_.default.useMemo(function(){var e;return(null===(e=b.tabData)||void 0===e?void 0:e.length)?b.tabData:v},[b.tabData]),ze=_.default.useMemo(function(){return He.filter(function(e){var n=p(e.tabName);return!((!K||$)&&"assignees"===n)&&(!ne||"reminders"!==n)})},[He,K,$,ne]),Ve=a.useState(null!==(L=null===(S=ze[0])||void 0===S?void 0:S.tabName)&&void 0!==L?L:""),Je=Ve[0],Xe=Ve[1],Ke=p(Je),Qe=_.default.useMemo(function(){return R(x||c)},[]),Ze=a.useState(Qe),$e=Ze[0],en=Ze[1],nn=a.useState(M||!1),an=nn[0],tn=nn[1],rn=a.useState(F||null),sn=rn[0],ln=rn[1],on=_.default.useRef(!1),dn=_.default.useRef(!1),un=_.default.useRef(!1),_n=_.default.useRef(D(Qe)),cn=_.default.useRef(!!M),vn=_.default.useRef(E(F||null)),fn=_.default.useCallback(function(e){on.current=!0,en(e)},[]),pn=_.default.useCallback(function(e){dn.current=!0,tn(e)},[]),mn=_.default.useCallback(function(e){un.current=!0,ln(e)},[]),gn=a.useState(null),Rn=gn[0],Sn=gn[1],Dn=a.useState([]),En=Dn[0],An=Dn[1],yn=a.useState(oe||f),Ln=yn[0],hn=yn[1],bn=void 0!==ue?ue:En,Tn=void 0!==_e?_e:An,Nn=void 0!==oe?oe:Ln,xn=function(){return l.startOfCalendarDay(new Date)},In=_.default.useMemo(function(){return{due_at:sn?sn.toISOString():"",assignee:$e.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))},{})}},[sn,$e]);a.useEffect(function(){void 0!==oe&&hn(oe)},[oe]),a.useEffect(function(){J&&J().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)})},[]),a.useEffect(function(){fe&&ze.some(function(e){return e.tabName===fe})&&Xe(fe)},[fe,ze]),a.useEffect(function(){var e,n;ze.some(function(e){return e.tabName===Je})||Xe(null!==(n=null===(e=ze[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[ze,Je]),a.useEffect(function(){if(x){var e=R(x,$e),n=D(e),i=D($e);n!==_n.current&&(on.current&&n!==i||(_n.current=n,on.current=!1,n!==i&&en(e)))}},[x,$e]),a.useEffect(function(){if(void 0!==M){var e=!!M;e!==cn.current&&(dn.current&&e!==an||(cn.current=e,dn.current=!1,e!==an&&tn(e)))}},[M,an]),a.useEffect(function(){if(void 0!==F){var e=null!=F?F:null,n=E(e),i=E(sn);n!==vn.current&&(un.current&&n!==i||(vn.current=n,un.current=!1,n!==i&&ln(e)))}},[F,sn]),a.useEffect(function(){en(function(n){var i,a=n.filter(function(e){return!e.isHidden}),t=n.find(function(e){return e.isHidden});if(an){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==Rn?void 0:Rn.id)||"me",email:(null==r?void 0:r.email)||(null==Rn?void 0:Rn.email)||"",name:y(Q,r,Rn),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)})},[an,Rn]),a.useEffect(function(){var e=$e.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});hn(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:""}}})})},[$e]);var Mn=$e.filter(function(e){return!e.isHidden}),Pn=l.getLatestLevelDueDate(Mn),Fn=Pn&&Pn>xn()?Pn:xn(),jn=Mn.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}),wn=!1!==b.showFinalApprovalDueDate,qn=!!jn||wn&&!sn,Cn=l.getApprovalDateValidationError(Mn,sn),Bn=H||qn||!!Cn,Wn=b.wrapperTitle||"Assign Redline and Manage Reminders",Un=b.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Yn=b.wrapperPriority||"High",Gn=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({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modal),"reminders"===Ke?{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:Wn})),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:Un})),n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineBadge),Gn),O.redlineBadge)},{children:Yn}))]}))]})),n.jsx("button",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.closeBtn),O.closeBtn),onClick:w},{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:ze.map(function(i){var a=Je===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 Xe(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"===Ke&&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(sn),onChange:function(e){var n="function"==typeof e?e(sn):e;n&&l.startOfCalendarDay(n)<Fn?null==B||B("Final approval due date cannot be before the latest level due date"):mn(n?l.normalizeApprovalDate(n):null)},minDate:Fn,disabled:null==V?void 0: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:$e,totalLevels:Y,requireFinalApproval:an,setLevels:fn,setRequireFinalApproval:function(e){pn(e)},fetchUsers:q,onValidationError:B,customStyles:O,finalApprovalDueDate:sn,displayConfig:V})]}),"reminders"===Ke&&n.jsx(o.ManageReminders,e.__assign({data:In,schedules:bn,setSchedules:Tn,remainderOwners:Nn,setRemainderOwners:function(e){var n="function"==typeof e?e(Nn):e;de?de(n):hn(n)},handelSendNow:function(e,n){ce&&ce(e||bn,n||Nn)},showPreviewEmail:null!=ve&&ve},void 0!==pe&&{labels:pe},void 0!==me&&{colors:me},void 0!==ge&&{chipColor:ge},void 0!==Re&&{assignees:Re},void 0!==Se&&{fallbackRecipients:Se},void 0!==De&&{recipientsColor:De},void 0!==Ee&&{manualReminderTitle:Ee},void 0!==Ae&&{manualReminderDescription:Ae},void 0!==ye&&{lastReminderText:ye},void 0!==Le&&{selectRecipientsLabel:Le},void 0!==he&&{previewEmailButtonLabel:he},void 0!==be&&{sendNowButtonLabel:be},void 0!==Te&&{reminderSuccessTitle:Te},void 0!==Ne&&{reminderSuccessDescription:Ne},void 0!==xe&&{escalationTitle:xe},void 0!==Ie&&{escalationTitleTooltip:Ie},void 0!==Me&&{escalationDescription:Me},void 0!==Pe&&{configureAutoReminderText:Pe},void 0!==Fe&&{getDynamicStatement:Fe},void 0!==je&&{reminderStartDateLabel:je},void 0!==we&&{documentDueDateLabel:we},void 0!==qe&&{reminderFrequencyLabel:qe},void 0!==Ce&&{escalationRemindersLabel:Ce},void 0!==Be&&{escalationTooltip:Be},void 0!==We&&{escalationConditionText:We},void 0!==Ue&&{daysText:Ue},void 0!==Ye&&{dueDataAndRepeatText:Ye},void 0!==Ge&&{reminderFrequencyOptions:Ge},void 0!==Oe&&{escalationFrequencyOptions:Oe},void 0!==ke&&{beforeAfterOptions:ke})),"review"===Ke&&n.jsx(r.default,{levels:$e,reviewData:N,showApproveAndMoveToNextLevelButton:W,onApproveAndMoveToNextLevel:U})]})),!le&&(!ae||!re)&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.footer),O.footer)},{children:[!ae&&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(){fn(m(c.map(function(n){return e.__assign(e.__assign({},n),{assignees:[],dueDate:null})}))),pn(!1),mn(null)},disabled:H},{children:"Clear"})),!re&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.saveBtn),O.saveBtn),Bn?e.__assign({opacity:.55,cursor:"not-allowed"},O.actionBtnDisabled):{}),onClick:function(){if(Bn)H||null==B||B(Cn||function(){if(wn&&!sn)return"Final approval due date is required";if(!jn)return"Please fill all required fields before saving";var e=Mn.indexOf(jn)+1,n=[jn.dueDate?null:"due date",(jn.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($e.filter(function(e){return!e.isHidden}));null==I||I(e),null==P||P(an),null==j||j(sn),null==C||C({levels:e,requireFinalApproval:an,finalApprovalDueDate:sn,activeTab:Ke,schedules:bn,remainderOwners:Nn})}},disabled:Bn},{children:"Save Changes"}))]}))]}))}))},exports.INITIAL_LEVELS=c;
|
|
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"),s=require("./components/ReviewStatus.js"),r=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 p(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})})},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})})})})},S=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}),s=n.filter(function(e){return!e.isHidden}),r=a||t,l=r?e.__spreadArray(e.__spreadArray([],s,!0),[r],!1):s;return g(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():""},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:R(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,s,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!==(s=null!==(t=e.accessLevel)&&void 0!==t?t:e.role)&&void 0!==s?s:"",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)},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"),s=String(n.getDate()).padStart(2,"0");return"".concat(a,"-").concat(t,"-").concat(s)},y=function(e,n,i){return(null==e?void 0:e.name)||(null==n?void 0:n.email)||(null==i?void 0:i.email)||"Owner"};exports.AssignReminderWrapper=function(u){var R,L,h=u.metadata,b=void 0===h?{}:h,T=u.reviewData,N=void 0===T?{}:T,x=u.levels,I=u.setLevels,P=u.requireFinalApproval,M=u.setRequireFinalApproval,F=u.approvalDueDate,j=u.setApprovalDueDate,w=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.ownerDetails,Z=u.blockEditScreen,$=void 0!==Z&&Z,ee=u.hideManageReminders,ne=void 0!==ee&&ee,ie=u.hideClearButton,ae=void 0!==ie&&ie,te=u.hideSaveChangesButton,se=void 0!==te&&te,re=u.hideFooterActions,le=void 0!==re&&re;u.hideAssigneeApproverScreen,u.remindersData;var oe=u.remainderOwners,de=u.setRemainderOwners,ue=u.schedules,_e=u.setSchedules,ce=u.handelSendNow,ve=u.showPreviewEmail,fe=u.tabName,pe=u.reminderLabels,me=u.reminderColors,ge=u.reminderChipColor,Se=u.reminderAssignees,Re=u.reminderFallbackRecipients,De=u.reminderRecipientsColor,Ee=u.manualReminderTitle,Ae=u.manualReminderDescription,ye=u.lastReminderText,Le=u.selectRecipientsLabel,he=u.previewEmailButtonLabel,be=u.sendNowButtonLabel,Te=u.reminderSuccessTitle,Ne=u.reminderSuccessDescription,xe=u.escalationTitle,Ie=u.escalationTitleTooltip,Pe=u.escalationDescription,Me=u.configureAutoReminderText,Fe=u.getDynamicStatement,je=u.reminderStartDateLabel,we=u.documentDueDateLabel,qe=u.reminderFrequencyLabel,Ce=u.escalationRemindersLabel,Be=u.escalationTooltip,We=u.escalationConditionText,Ue=u.daysText,Ye=u.dueDataAndRepeatText,Ge=u.reminderFrequencyOptions,Oe=u.escalationFrequencyOptions,ke=u.beforeAfterOptions,He=_.default.useMemo(function(){var e;return(null===(e=b.tabData)||void 0===e?void 0:e.length)?b.tabData:v},[b.tabData]),ze=_.default.useMemo(function(){return He.filter(function(e){var n=p(e.tabName);return!((!K||$)&&"assignees"===n)&&(!ne||"reminders"!==n)})},[He,K,$,ne]),Ve=a.useState(null!==(L=null===(R=ze[0])||void 0===R?void 0:R.tabName)&&void 0!==L?L:""),Je=Ve[0],Xe=Ve[1],Ke=p(Je),Qe=_.default.useMemo(function(){return S(x||c)},[]),Ze=a.useState(Qe),$e=Ze[0],en=Ze[1],nn=a.useState(P||!1),an=nn[0],tn=nn[1],sn=a.useState(F||null),rn=sn[0],ln=sn[1],on=_.default.useRef(!1),dn=_.default.useRef(!1),un=_.default.useRef(!1),_n=_.default.useRef(D(Qe)),cn=_.default.useRef(!!P),vn=_.default.useRef(E(F||null)),fn=_.default.useCallback(function(e){on.current=!0,en(e)},[]),pn=_.default.useCallback(function(e){dn.current=!0,tn(e)},[]),mn=_.default.useCallback(function(e){un.current=!0,ln(e)},[]),gn=a.useState(null),Sn=gn[0],Rn=gn[1],Dn=a.useState([]),En=Dn[0],An=Dn[1],yn=a.useState(oe||f),Ln=yn[0],hn=yn[1],bn=void 0!==ue?ue:En,Tn=void 0!==_e?_e:An,Nn=void 0!==oe?oe:Ln,xn=function(){return l.startOfCalendarDay(new Date)},In=_.default.useMemo(function(){return{due_at:rn?rn.toISOString():"",assignee:$e.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,$e]);a.useEffect(function(){void 0!==oe&&hn(oe)},[oe]),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(){fe&&ze.some(function(e){return e.tabName===fe})&&Xe(fe)},[fe,ze]),a.useEffect(function(){var e,n;ze.some(function(e){return e.tabName===Je})||Xe(null!==(n=null===(e=ze[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[ze,Je]),a.useEffect(function(){if(x){var e=S(x,$e),n=D(e),i=D($e);n!==_n.current&&(on.current&&n!==i||(_n.current=n,on.current=!1,n!==i&&en(e)))}},[x,$e]),a.useEffect(function(){if(void 0!==P){var e=!!P;e!==cn.current&&(dn.current&&e!==an||(cn.current=e,dn.current=!1,e!==an&&tn(e)))}},[P,an]),a.useEffect(function(){if(void 0!==F){var e=null!=F?F:null,n=E(e),i=E(rn);n!==vn.current&&(un.current&&n!==i||(vn.current=n,un.current=!1,n!==i&&ln(e)))}},[F,rn]),a.useEffect(function(){en(function(n){var i,a=n.filter(function(e){return!e.isHidden}),t=n.find(function(e){return e.isHidden});if(an){var s=null===(i=null==t?void 0:t.assignees)||void 0===i?void 0:i[0],r=e.__assign(e.__assign({},s),{id:(null==s?void 0:s.id)||(null==Sn?void 0:Sn.id)||"me",email:(null==s?void 0:s.email)||(null==Sn?void 0:Sn.email)||"",name:y(Q,s,Sn),accessLevel:(null==s?void 0:s.accessLevel)||"Approve",role:(null==s?void 0:s.role)||"Final Approver"}),l=e.__assign(e.__assign({},t),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[r]});return g(e.__spreadArray(e.__spreadArray([],a,!0),[l],!1))}return g(a)})},[an,Sn]),a.useEffect(function(){var e=$e.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});hn(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:""}}})})},[$e]);var Pn=$e.filter(function(e){return!e.isHidden}),Mn=Pn.some(function(e){return(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})}),Fn=l.getLatestLevelDueDate(Pn),jn=Fn&&Fn>xn()?Fn:xn(),wn=Pn.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}),qn=!1!==b.showFinalApprovalDueDate,Cn=!!wn||qn&&!rn,Bn=l.getApprovalDateValidationError(Pn,rn),Wn=H||(null==V?void 0:V.disableSaveChanges)||!Mn||Cn||!!Bn,Un=b.wrapperTitle||"Assign Redline and Manage Reminders",Yn=b.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Gn=b.wrapperPriority||"High",On=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({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modal),"reminders"===Ke?{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:Un})),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:Yn})),n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineBadge),On),O.redlineBadge)},{children:Gn}))]}))]})),n.jsx("button",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.closeBtn),O.closeBtn),onClick:w},{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:ze.map(function(i){var a=Je===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 Xe(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"===Ke&&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(r.default,{value:A(rn),onChange:function(e){var n="function"==typeof e?e(rn):e;n&&l.startOfCalendarDay(n)<jn?null==B||B("Final approval due date cannot be before the latest level due date"):mn(n?l.normalizeApprovalDate(n):null)},minDate:jn,disabled:null==V?void 0: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:$e,totalLevels:Y,requireFinalApproval:an,setLevels:fn,setRequireFinalApproval:function(e){pn(e)},fetchUsers:q,onValidationError:B,customStyles:O,finalApprovalDueDate:rn,displayConfig:V})]}),"reminders"===Ke&&n.jsx(o.ManageReminders,e.__assign({data:In,schedules:bn,setSchedules:Tn,remainderOwners:Nn,setRemainderOwners:function(e){var n="function"==typeof e?e(Nn):e;de?de(n):hn(n)},handelSendNow:function(e,n){ce&&ce(e||bn,n||Nn)},showPreviewEmail:null!=ve&&ve},void 0!==pe&&{labels:pe},void 0!==me&&{colors:me},void 0!==ge&&{chipColor:ge},void 0!==Se&&{assignees:Se},void 0!==Re&&{fallbackRecipients:Re},void 0!==De&&{recipientsColor:De},void 0!==Ee&&{manualReminderTitle:Ee},void 0!==Ae&&{manualReminderDescription:Ae},void 0!==ye&&{lastReminderText:ye},void 0!==Le&&{selectRecipientsLabel:Le},void 0!==he&&{previewEmailButtonLabel:he},void 0!==be&&{sendNowButtonLabel:be},void 0!==Te&&{reminderSuccessTitle:Te},void 0!==Ne&&{reminderSuccessDescription:Ne},void 0!==xe&&{escalationTitle:xe},void 0!==Ie&&{escalationTitleTooltip:Ie},void 0!==Pe&&{escalationDescription:Pe},void 0!==Me&&{configureAutoReminderText:Me},void 0!==Fe&&{getDynamicStatement:Fe},void 0!==je&&{reminderStartDateLabel:je},void 0!==we&&{documentDueDateLabel:we},void 0!==qe&&{reminderFrequencyLabel:qe},void 0!==Ce&&{escalationRemindersLabel:Ce},void 0!==Be&&{escalationTooltip:Be},void 0!==We&&{escalationConditionText:We},void 0!==Ue&&{daysText:Ue},void 0!==Ye&&{dueDataAndRepeatText:Ye},void 0!==Ge&&{reminderFrequencyOptions:Ge},void 0!==Oe&&{escalationFrequencyOptions:Oe},void 0!==ke&&{beforeAfterOptions:ke})),"review"===Ke&&n.jsx(s.default,{levels:$e,reviewData:N,showApproveAndMoveToNextLevelButton:W,onApproveAndMoveToNextLevel:U})]})),!le&&(!ae||!se)&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.footer),O.footer)},{children:[!ae&&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(){fn(m(c.map(function(n){return e.__assign(e.__assign({},n),{assignees:[],dueDate:null})}))),pn(!1),mn(null)},disabled:H},{children:"Clear"})),!se&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},d.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.saveBtn),O.saveBtn),Wn?e.__assign({opacity:.55,cursor:"not-allowed"},O.actionBtnDisabled):{}),onClick:function(){if(Wn)H||null==B||B(Bn||function(){if(!Mn)return"Please select at least one user before saving";if(qn&&!rn)return"Final approval due date is required";if(!wn)return"Please fill all required fields before saving";var e=Pn.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($e.filter(function(e){return!e.isHidden}));null==I||I(e),null==M||M(an),null==j||j(rn),null==C||C({levels:e,requireFinalApproval:an,finalApprovalDueDate:rn,activeTab:Ke,schedules:bn,remainderOwners:Nn})}},disabled:Wn},{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"),i=require("react"),n=require("lucide-react"),t=require("@mui/material/Checkbox"),r=require("@mui/material"),l=require("framer-motion"),a=require("@mui/x-date-pickers"),o=require("@mui/x-date-pickers/AdapterDayjs"),d=require("./components/ReminderFrequencyAutocomplete.js"),c=require("./components/AssigneeCalendarView.js"),u=require("dayjs"),y=require("./styles/ManageReminder.style.js");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=_(t),v=_(u),g=["Assignee 1","Assignee 2","Assignee 3"],h=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],x=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],f=[{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"}],j=[{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"}],b=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"},C={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}};exports.ManageReminders=function(t){var u=t.data,_=t.schedules,F=t.setSchedules,k=t.remainderOwners,D=t.setRemainderOwners,R=t.labels,E=void 0===R?g:R,S=t.colors,w=void 0===S?h:S,I=t.chipColor,A=void 0===I?x:I,B=t.assignees,T=void 0===B?f:B,q=t.fallbackRecipients,L=void 0===q?j:q,P=t.recipientsColor,M=void 0===P?p:P,O=t.manualReminderTitle,Y=void 0===O?"Send Manual Reminder Now":O,N=t.manualReminderDescription,H=void 0===N?"Immediately notify the assignees about this document.":N;t.lastReminderText;var z=t.selectRecipientsLabel,W=void 0===z?"Select recipients:":z,G=t.previewEmailButtonLabel,V=void 0===G?"Preview Email":G,U=t.sendNowButtonLabel,J=void 0===U?"Send Now":U,Z=t.reminderSuccessTitle,K=void 0===Z?"Reminder sent successfully!":Z,Q=t.reminderSuccessDescription,X=void 0===Q?"Email notification sent to assignees.":Q,$=t.escalationTitle,ee=void 0===$?"Escalation and Auto Reminder Setup":$;t.escalationTitleTooltip;var se=t.escalationDescription,ie=void 0===se?"Configure Auto reminder settings for all assignees.":se;t.configureAutoReminderText;var ne=t.getDynamicStatement,te=void 0===ne?b:ne,re=t.reminderStartDateLabel,le=void 0===re?"Reminder Start Date":re,ae=t.documentDueDateLabel,oe=void 0===ae?"Document Due Date":ae,de=t.reminderFrequencyLabel,ce=void 0===de?"Reminder Frequency":de,ue=t.escalationRemindersLabel,ye=void 0===ue?"Escalation Reminders":ue;t.escalationTooltip;var _e=t.escalationConditionText,me=void 0===_e?"If the document is still pending, start escalation reminders":_e,ve=t.daysText,ge=void 0===ve?"days":ve,he=t.dueDataAndRepeatText,xe=void 0===he?"due date and repeat every":he,fe=t.reminderFrequencyOptions,pe=void 0===fe?["12 hours","24 hours","48 hours","72 hours","Custom"]:fe,je=t.escalationFrequencyOptions,be=void 0===je?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:je,Ce=t.beforeAfterOptions,Fe=void 0===Ce?["After","Before"]:Ce,ke=t.handelSendNow,De=t.showPreviewEmail,Re=void 0===De||De,Ee=i.useState(!1),Se=Ee[0],we=Ee[1],Ie=i.useState(!1),Ae=Ie[0],Be=Ie[1],Te=i.useState(!1),qe=Te[0],Le=Te[1],Pe=i.useState(!0),Me=Pe[0],Oe=Pe[1],Ye=i.useState(L),Ne=Ye[0],He=Ye[1];l.useDragControls();var ze=function(s,i,n){D(function(t){return t.map(function(t,r){var l;return r===s?e.__assign(e.__assign({},t),((l={})[i]=n,l)):t})})},We=function(e,s){ze(e,"reminder_start_date",s)},Ge=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},Ve=function(e,s,i){if(!e||!i)return[];var n=Ge(i);if(!n||n<=0)return[];for(var t=[],r=v.default(e).valueOf(),l=s?v.default(s).valueOf():v.default(e).add(45,"day").valueOf(),a=0;r<=l&&a<150;)t.push(v.default(r).toISOString()),r+=n,a++;return t},Ue=function(e,s,i,n){if(!(e&&s&&n&&i))return[];var t=Ge(n);if(!t)return[];var r,l=v.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(v.default(d).toISOString()),d+=t;return o},Je=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};i.useEffect(function(){var e=(null==u?void 0:u.due_at)||"",s=Object.values((null==u?void 0:u.assignee)||{}),i=null==k?void 0:k.map(function(i,n){var t,r=s[n]||T.find(function(e){return e.id===String(i.id)}),l=(null===(t=null==w?void 0:w[n%w.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:Ve(i.reminder_start_date,e,i.reminder_frequency),escalations:Ue(e,i.days,i.before_or_after,i.escalation_reminder_frequency)}});F(i)},[k,null==u?void 0:u.due_at,null==u?void 0:u.assignee]),i.useEffect(function(){(null==u?void 0:u.assignee)&&He(function(e){var s=Object.values(u.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==M?void 0:M[i])||p[i%p.length]}});return s.length>0?s:L})},[null==u?void 0:u.assignee,null==u?void 0:u.due_at]);var Ze=Object.values((null==u?void 0:u.assignee)||{}).filter(function(e){return null==e?void 0:e.name});return s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrContainer),{width:"100%",minWidth:"850px"})},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionBox},{children:[s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrSectionHeader),{cursor:"pointer"}),onClick:function(){Se||we(!0)}},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionHeaderContent},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionHeaderLeft},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionTitleWrapper},{children:[s.jsx("div",e.__assign({style:y.styles.mrSectionTitleIcon},{children:s.jsx(n.Send,{style:y.styles.mrIconSmall})})),s.jsx("div",e.__assign({style:y.styles.mrSectionTitle},{children:Y}))]})),s.jsx("div",e.__assign({style:y.styles.mrSectionDescription},{children:H}))]})),s.jsx("div",e.__assign({style:y.styles.mrSectionHeaderRight},{children:s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),we(function(e){return!e})},style:y.styles.mrChevronButton},{children:s.jsx(n.ChevronDown,{style:e.__assign(e.__assign({},y.styles.mrChevronIcon),Se?y.styles.mrChevronRotated:{})})}))}))]})),s.jsx(l.AnimatePresence,{children:qe&&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:y.styles.mrSuccessMessage},{children:[s.jsx("div",e.__assign({style:y.styles.mrSuccessIcon},{children:s.jsx("div",e.__assign({style:y.styles.mrSuccessIconInner},{children:s.jsx(n.CircleCheckBigIcon,{style:y.styles.mrIconSuccess})}))})),s.jsxs("div",e.__assign({style:y.styles.mrSuccessText},{children:[s.jsx("div",e.__assign({style:y.styles.mrSuccessTitle},{children:K})),s.jsx("div",e.__assign({style:y.styles.mrSuccessDescription},{children:X}))]}))]}))})]})),s.jsx(l.AnimatePresence,{children:Se&&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({},y.styles.mrHiddenSection),{pointerEvents:Se?"auto":"none"})},{children:[s.jsxs("div",e.__assign({style:y.styles.mrRecipientsSection},{children:[s.jsx("div",e.__assign({style:y.styles.mrRecipientsLabel},{children:W})),s.jsx("div",e.__assign({style:y.styles.mrRecipientsGrid},{children:Ne.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=p[n%p.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=p[n%p.length])||void 0===a?void 0:a.text)||"#1E40AF";return s.jsxs("div",e.__assign({style:y.styles.mrRecipientItem},{children:[s.jsx(m.default,{checked:i.checked,onChange:function(){return s=i.name,void He(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:y.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:y.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:y.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:y.styles.mrRecipientInfo},{children:[s.jsx("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrRecipientAvatar),{backgroundColor:o,color:d})},{children:Je(i.name)})),s.jsx("div",e.__assign({style:y.styles.mrRecipientName},{children:i.name}))]}))]}),i.name)})}))]})),s.jsxs("div",e.__assign({style:y.styles.mrActionsSection},{children:[Re&&s.jsxs("button",e.__assign({onClick:function(e){e.stopPropagation()},type:"button",style:e.__assign(e.__assign({},y.styles.mrActionButton),y.styles.mrActionButtonSecondary)},{children:[s.jsx(n.Mail,{style:y.styles.mrIconAction}),V]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Le(!0),setTimeout(function(){return Le(!1)},3e3);var s=Ne.filter(function(e){return e.checked});ke(_,k.filter(function(e){return s.some(function(s){return s.id===e.id})}))},style:e.__assign(e.__assign({},y.styles.mrActionButton),y.styles.mrActionButtonPrimary)},{children:J}))]}))]}))})]})),s.jsxs("div",e.__assign({style:y.styles.mrMainContent},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationContainer},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Ae||Be(!0)}},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationHeader},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationTitleWrapper},{children:[s.jsx("div",e.__assign({style:y.styles.mrEscalationTitleText},{children:ee})),s.jsx("div",e.__assign({style:y.styles.mrTooltipIcon},{children:s.jsx(n.InfoIcon,{stroke:"#64748B",style:y.styles.mrIconInfo})}))]})),s.jsxs("div",e.__assign({style:y.styles.mrEscalationActions},{children:[Re&&s.jsxs("button",e.__assign({style:y.styles.mrEscalationPreviewButton},{children:[s.jsx("div",e.__assign({style:y.styles.mrEscalationPreviewIcon},{children:s.jsx(n.Mail,{style:y.styles.mrIconPreview})})),s.jsx("span",e.__assign({style:y.styles.mrEscalationPreviewText},{children:V}))]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Be(function(e){return!e})},style:y.styles.mrChevronButton},{children:s.jsx(n.ChevronDown,{style:e.__assign(e.__assign({},y.styles.mrChevronIcon),Ae?y.styles.mrChevronRotated:{})})}))]}))]})),s.jsx("div",e.__assign({style:y.styles.mrEscalationDescription},{children:ie}))]})),s.jsx(l.AnimatePresence,e.__assign({initial:!1},{children:Ae&&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){D(e)},layoutScroll:!0,style:y.styles.mrReorderGroup},{children:null==k?void 0:k.map(function(i,t){var c,_,g,h,x=Ze[t]||L[t],f=(null===(c=null==w?void 0:w[t])||void 0===c?void 0:c.bg)||"#FDF2FA",p=(null===(_=null==w?void 0:w[t])||void 0===_?void 0:_.text)||"#C11574",j=(null===(g=null==A?void 0:A[t])||void 0===g?void 0:g.bg)||"transparent",b=(null===(h=null==A?void 0:A[t])||void 0===h?void 0:h.text)||"inherit";return s.jsxs("div",e.__assign({style:y.styles.mrReminderItem},{children:[s.jsx("div",e.__assign({style:y.styles.mrReminderLabelBox},{children:s.jsx("div",e.__assign({style:y.styles.mrReminderLabelInner},{children:s.jsx(r.Chip,{label:(null==E?void 0:E[t])||"Assignee ".concat(t+1),sx:{backgroundColor:f,minWidth:90,color:p,fontWeight:500}})}))})),s.jsxs("div",e.__assign({style:y.styles.mrReminderContent},{children:[s.jsx("div",{style:y.styles.mrDragHandle}),s.jsx(r.Box,e.__assign({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:y.styles.mrReminderBox},{children:s.jsxs("div",e.__assign({style:y.styles.mrReminderFields},{children:[s.jsxs("div",e.__assign({style:y.styles.mrReminderHeader},{children:[s.jsxs("div",e.__assign({style:y.styles.mrReminderAssignee},{children:[s.jsx("div",e.__assign({style:y.styles.mrReminderAvatar},{children:s.jsx("span",e.__assign({style:y.styles.mrReminderInitials},{children:Je(null==x?void 0:x.name)}))})),s.jsx("span",e.__assign({style:y.styles.mrReminderName},{children:null==x?void 0:x.name}))]})),s.jsx("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrReminderStatement),{backgroundColor:j})},{children:s.jsx("span",e.__assign({style:e.__assign(e.__assign({},y.styles.mrReminderStatementText),{color:b})},{children:te(i)}))}))]})),s.jsxs("div",e.__assign({style:y.styles.mrReminderDateFields},{children:[s.jsxs("div",e.__assign({style:y.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:y.styles.mrReminderFieldLabel},{children:le})),s.jsxs("div",e.__assign({style:y.styles.mrReminderDatePicker},{children:[s.jsx(a.LocalizationProvider,e.__assign({dateAdapter:o.AdapterDayjs},{children:s.jsx(a.DatePicker,{value:i.reminder_start_date?v.default(i.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&v.default(e).isValid()){if(v.default(e).isBefore(v.default(),"day"))return;We(t,v.default(e).toISOString())}else We(t,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:C,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:y.styles.mrIconArrow})]}))]})),s.jsxs("div",e.__assign({style:y.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:y.styles.mrReminderFieldLabel},{children:oe})),s.jsx("div",e.__assign({style:y.styles.mrReminderDueDate},{children:(null==u?void 0:u.due_at)?v.default(u.due_at).format("MM/DD/YYYY"):""}))]})),s.jsxs("div",e.__assign({style:y.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:y.styles.mrReminderFieldLabel},{children:ce})),s.jsxs("div",e.__assign({style:y.styles.mrReminderFrequency},{children:[s.jsx("span",e.__assign({style:y.styles.mrReminderFrequencyText},{children:"Every"})),s.jsx(d.default,{value:i.reminder_frequency,onChange:function(e){return function(e,s){ze(e,"reminder_frequency",s)}(t,e)},options:pe,suffix:"hours"})]}))]}))]})),s.jsxs("div",e.__assign({style:y.styles.mrEscalationCheckbox},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationCheckboxHeader},{children:[s.jsx(m.default,{size:"small",disableRipple:!0,checked:i.is_escalation_reminder,onChange:function(e){return function(e,s){ze(e,"is_escalation_reminder",s),s||(ze(e,"days",{type:"preset",value:""}),ze(e,"escalation_reminder_frequency",{type:"preset",value:""}),ze(e,"before_or_after",""))}(t,e.target.checked)},icon:s.jsx("div",{style:y.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:y.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:y.styles.mrCheckboxIcon},{children:s.jsx("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),ye,s.jsx("div",e.__assign({style:y.styles.mrTooltipIcon},{children:s.jsx(n.InfoIcon,{stroke:"#64748B",style:y.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:y.styles.mrEscalationContent},{children:[s.jsx("div",e.__assign({style:y.styles.mrEscalationCondition},{children:me})),s.jsxs("div",e.__assign({style:y.styles.mrEscalationFields},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationFieldGroup},{children:[s.jsx(d.default,{value:i.days,onChange:function(e){return function(e,s){ze(e,"days",s)}(t,e)}}),s.jsx("div",e.__assign({style:y.styles.mrEscalationFieldText},{children:ge}))]})),s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrEscalationFieldGroup),y.styles.mrEscalationFieldGroupLarge)},{children:[s.jsx(r.Autocomplete,{size:"small",options:Fe,value:i.before_or_after,onChange:function(e,s){return function(e,s){ze(e,"before_or_after",s)}(t,s||"")},popupIcon:s.jsx(n.ChevronDown,{style:y.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:C}))},sx:{width:"100%"}}),s.jsx("div",e.__assign({style:y.styles.mrEscalationFieldText},{children:xe}))]})),s.jsx("div",e.__assign({style:y.styles.mrEscalationFieldGroupSmall},{children:s.jsx(d.default,{value:i.escalation_reminder_frequency,onChange:function(e){return function(e,s){ze(e,"escalation_reminder_frequency",s)}(t,e)},options:be,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))})}))}))}))]})),Ae&&s.jsxs(l.motion.div,e.__assign({initial:{width:Me?"345px":"43px"},animate:{width:Me?"345px":"43px"},transition:{duration:.3},style:y.styles.mrCalendarPanel},{children:[Me?s.jsx(c.default,{assignees:_}):s.jsx("div",e.__assign({style:y.styles.mrCalendarCollapsed},{children:s.jsx(n.CalendarIcon,{style:y.styles.mrIconCalendar})})),s.jsxs("button",e.__assign({onClick:function(){return Oe(function(e){return!e})},style:y.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"})})),Me?s.jsx(n.ChevronRight,{style:y.styles.mrIconChevronToggle}):s.jsx(n.ChevronLeft,{style:y.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/x-date-pickers"),o=require("@mui/x-date-pickers/AdapterDayjs"),d=require("./components/ReminderFrequencyAutocomplete.js"),c=require("./components/AssigneeCalendarView.js"),u=require("dayjs"),y=require("./styles/ManageReminder.style.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=m(t),v=m(u),g=["Assignee 1","Assignee 2","Assignee 3"],h=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],x=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],p=[{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")}],f=[{bg:"#DBEAFE",text:"#1E40AF"},{bg:"#CCFBF1",text:"#0D9488"},{bg:"#DCFCE7",text:"#166534"}],j=[{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"}],b=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"},C={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}};exports.ManageReminders=function(t){var u=t.data,m=t.schedules,F=t.setSchedules,k=t.remainderOwners,D=t.setRemainderOwners,R=t.labels,E=void 0===R?g:R,S=t.colors,w=void 0===S?h:S,I=t.chipColor,A=void 0===I?x:I,B=t.assignees,T=void 0===B?p:B,q=t.fallbackRecipients,L=void 0===q?j:q,P=t.recipientsColor,M=void 0===P?f:P,O=t.manualReminderTitle,Y=void 0===O?"Send Manual Reminder Now":O,N=t.manualReminderDescription,H=void 0===N?"Immediately notify the assignees about this document.":N;t.lastReminderText;var z=t.selectRecipientsLabel,W=void 0===z?"Select recipients:":z,G=t.previewEmailButtonLabel,V=void 0===G?"Preview Email":G,U=t.sendNowButtonLabel,J=void 0===U?"Send Now":U,Z=t.reminderSuccessTitle,K=void 0===Z?"Reminder sent successfully!":Z,Q=t.reminderSuccessDescription,X=void 0===Q?"Email notification sent to assignees.":Q,$=t.escalationTitle,ee=void 0===$?"Escalation and Auto Reminder Setup":$;t.escalationTitleTooltip;var se=t.escalationDescription,ie=void 0===se?"Configure Auto reminder settings for all assignees.":se;t.configureAutoReminderText;var ne=t.getDynamicStatement,te=void 0===ne?b:ne,re=t.reminderStartDateLabel,le=void 0===re?"Reminder Start Date":re,ae=t.documentDueDateLabel,oe=void 0===ae?"Document Due Date":ae,de=t.reminderFrequencyLabel,ce=void 0===de?"Reminder Frequency":de,ue=t.escalationRemindersLabel,ye=void 0===ue?"Escalation Reminders":ue;t.escalationTooltip;var me=t.escalationConditionText,_e=void 0===me?"If the document is still pending, start escalation reminders":me,ve=t.daysText,ge=void 0===ve?"days":ve,he=t.dueDataAndRepeatText,xe=void 0===he?"due date and repeat every":he,pe=t.reminderFrequencyOptions,fe=void 0===pe?["12 hours","24 hours","48 hours","72 hours","Custom"]:pe,je=t.escalationFrequencyOptions,be=void 0===je?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:je,Ce=t.beforeAfterOptions,Fe=void 0===Ce?["After","Before"]:Ce,ke=t.handelSendNow,De=t.showPreviewEmail,Re=void 0===De||De,Ee=i.useState(!1),Se=Ee[0],we=Ee[1],Ie=i.useState(!1),Ae=Ie[0],Be=Ie[1],Te=i.useState(!1),qe=Te[0],Le=Te[1],Pe=i.useState(!0),Me=Pe[0],Oe=Pe[1],Ye=i.useState(L),Ne=Ye[0],He=Ye[1];l.useDragControls();var ze=function(s,i,n){D(function(t){return t.map(function(t,r){var l;return r===s?e.__assign(e.__assign({},t),((l={})[i]=n,l)):t})})},We=function(e,s){ze(e,"reminder_start_date",s)},Ge=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},Ve=function(e,s,i){if(!e||!i)return[];var n=Ge(i);if(!n||n<=0)return[];for(var t=[],r=v.default(e).valueOf(),l=s?v.default(s).valueOf():v.default(e).add(45,"day").valueOf(),a=0;r<=l&&a<150;)t.push(v.default(r).toISOString()),r+=n,a++;return t},Ue=function(e,s,i,n){if(!(e&&s&&n&&i))return[];var t=Ge(n);if(!t)return[];var r,l=v.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(v.default(d).toISOString()),d+=t;return o},Je=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};i.useEffect(function(){var e=(null==u?void 0:u.due_at)||"",s=Object.values((null==u?void 0:u.assignee)||{}),i=null==k?void 0:k.map(function(i,n){var t,r=s[n]||T.find(function(e){return e.id===String(i.id)}),l=(null===(t=null==w?void 0:w[n%w.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:Ve(i.reminder_start_date,e,i.reminder_frequency),escalations:Ue(e,i.days,i.before_or_after,i.escalation_reminder_frequency)}});F(i)},[k,null==u?void 0:u.due_at,null==u?void 0:u.assignee]),i.useEffect(function(){(null==u?void 0:u.assignee)&&He(function(e){var s=Object.values(u.assignee).filter(function(e){return e&&Object.keys(e).length>0}).map(function(s,i){var n,t,r=e.find(function(e){return e.name===s.name});return{id:null!==(n=s.id)&&void 0!==n?n:i+1,name:s.name,email:null!==(t=s.email)&&void 0!==t?t:"",checked:!!r&&r.checked,recipientsColor:(null==M?void 0:M[i])||f[i%f.length]}});return s.length>0?s:L})},[null==u?void 0:u.assignee,null==u?void 0:u.due_at]);var Ze=Object.values((null==u?void 0:u.assignee)||{}).filter(function(e){return null==e?void 0:e.name}),Ke=Ne.filter(function(e){return e.checked}),Qe=0===Ke.length;return s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrContainer),{width:"100%",minWidth:"850px"})},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionBox},{children:[s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrSectionHeader),{cursor:"pointer"}),onClick:function(){Se||we(!0)}},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionHeaderContent},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionHeaderLeft},{children:[s.jsxs("div",e.__assign({style:y.styles.mrSectionTitleWrapper},{children:[s.jsx("div",e.__assign({style:y.styles.mrSectionTitleIcon},{children:s.jsx(n.Send,{style:y.styles.mrIconSmall})})),s.jsx("div",e.__assign({style:y.styles.mrSectionTitle},{children:Y}))]})),s.jsx("div",e.__assign({style:y.styles.mrSectionDescription},{children:H}))]})),s.jsx("div",e.__assign({style:y.styles.mrSectionHeaderRight},{children:s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),we(function(e){return!e})},style:y.styles.mrChevronButton},{children:s.jsx(n.ChevronDown,{style:e.__assign(e.__assign({},y.styles.mrChevronIcon),Se?y.styles.mrChevronRotated:{})})}))}))]})),s.jsx(l.AnimatePresence,{children:qe&&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:y.styles.mrSuccessMessage},{children:[s.jsx("div",e.__assign({style:y.styles.mrSuccessIcon},{children:s.jsx("div",e.__assign({style:y.styles.mrSuccessIconInner},{children:s.jsx(n.CircleCheckBigIcon,{style:y.styles.mrIconSuccess})}))})),s.jsxs("div",e.__assign({style:y.styles.mrSuccessText},{children:[s.jsx("div",e.__assign({style:y.styles.mrSuccessTitle},{children:K})),s.jsx("div",e.__assign({style:y.styles.mrSuccessDescription},{children:X}))]}))]}))})]})),s.jsx(l.AnimatePresence,{children:Se&&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({},y.styles.mrHiddenSection),{pointerEvents:Se?"auto":"none"})},{children:[s.jsxs("div",e.__assign({style:y.styles.mrRecipientsSection},{children:[s.jsx("div",e.__assign({style:y.styles.mrRecipientsLabel},{children:W})),s.jsx("div",e.__assign({style:y.styles.mrRecipientsGrid},{children:Ne.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=f[n%f.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=f[n%f.length])||void 0===a?void 0:a.text)||"#1E40AF";return s.jsxs("div",e.__assign({style:y.styles.mrRecipientItem},{children:[s.jsx(_.default,{checked:i.checked,onChange:function(){return s=i.name,void He(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:y.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:y.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:y.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:y.styles.mrRecipientInfo},{children:[s.jsx("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrRecipientAvatar),{backgroundColor:o,color:d})},{children:Je(i.name)})),s.jsx("div",e.__assign({style:y.styles.mrRecipientName},{children:i.name}))]}))]}),i.name)})}))]})),s.jsxs("div",e.__assign({style:y.styles.mrActionsSection},{children:[Re&&s.jsxs("button",e.__assign({onClick:function(e){e.stopPropagation()},type:"button",style:e.__assign(e.__assign({},y.styles.mrActionButton),y.styles.mrActionButtonSecondary)},{children:[s.jsx(n.Mail,{style:y.styles.mrIconAction}),V]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Qe||(Le(!0),setTimeout(function(){return Le(!1)},3e3),ke(m,k.filter(function(e){return Ke.some(function(s){return s.id===e.id||s.email===e.email||s.name===e.name})})))},disabled:Qe,style:e.__assign(e.__assign(e.__assign({},y.styles.mrActionButton),y.styles.mrActionButtonPrimary),Qe?{opacity:.55,cursor:"not-allowed"}:{})},{children:J}))]}))]}))})]})),s.jsxs("div",e.__assign({style:y.styles.mrMainContent},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationContainer},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Ae||Be(!0)}},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationHeader},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationTitleWrapper},{children:[s.jsx("div",e.__assign({style:y.styles.mrEscalationTitleText},{children:ee})),s.jsx("div",e.__assign({style:y.styles.mrTooltipIcon},{children:s.jsx(n.InfoIcon,{stroke:"#64748B",style:y.styles.mrIconInfo})}))]})),s.jsxs("div",e.__assign({style:y.styles.mrEscalationActions},{children:[Re&&s.jsxs("button",e.__assign({style:y.styles.mrEscalationPreviewButton},{children:[s.jsx("div",e.__assign({style:y.styles.mrEscalationPreviewIcon},{children:s.jsx(n.Mail,{style:y.styles.mrIconPreview})})),s.jsx("span",e.__assign({style:y.styles.mrEscalationPreviewText},{children:V}))]})),s.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),Be(function(e){return!e})},style:y.styles.mrChevronButton},{children:s.jsx(n.ChevronDown,{style:e.__assign(e.__assign({},y.styles.mrChevronIcon),Ae?y.styles.mrChevronRotated:{})})}))]}))]})),s.jsx("div",e.__assign({style:y.styles.mrEscalationDescription},{children:ie}))]})),s.jsx(l.AnimatePresence,e.__assign({initial:!1},{children:Ae&&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){D(e)},layoutScroll:!0,style:y.styles.mrReorderGroup},{children:null==k?void 0:k.map(function(i,t){var c,m,g,h,x=Ze[t]||L[t],p=(null===(c=null==w?void 0:w[t])||void 0===c?void 0:c.bg)||"#FDF2FA",f=(null===(m=null==w?void 0:w[t])||void 0===m?void 0:m.text)||"#C11574",j=(null===(g=null==A?void 0:A[t])||void 0===g?void 0:g.bg)||"transparent",b=(null===(h=null==A?void 0:A[t])||void 0===h?void 0:h.text)||"inherit";return s.jsxs("div",e.__assign({style:y.styles.mrReminderItem},{children:[s.jsx("div",e.__assign({style:y.styles.mrReminderLabelBox},{children:s.jsx("div",e.__assign({style:y.styles.mrReminderLabelInner},{children:s.jsx(r.Chip,{label:(null==E?void 0:E[t])||"Assignee ".concat(t+1),sx:{backgroundColor:p,minWidth:90,color:f,fontWeight:500}})}))})),s.jsxs("div",e.__assign({style:y.styles.mrReminderContent},{children:[s.jsx("div",{style:y.styles.mrDragHandle}),s.jsx(r.Box,e.__assign({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:y.styles.mrReminderBox},{children:s.jsxs("div",e.__assign({style:y.styles.mrReminderFields},{children:[s.jsxs("div",e.__assign({style:y.styles.mrReminderHeader},{children:[s.jsxs("div",e.__assign({style:y.styles.mrReminderAssignee},{children:[s.jsx("div",e.__assign({style:y.styles.mrReminderAvatar},{children:s.jsx("span",e.__assign({style:y.styles.mrReminderInitials},{children:Je(null==x?void 0:x.name)}))})),s.jsx("span",e.__assign({style:y.styles.mrReminderName},{children:null==x?void 0:x.name}))]})),s.jsx("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrReminderStatement),{backgroundColor:j})},{children:s.jsx("span",e.__assign({style:e.__assign(e.__assign({},y.styles.mrReminderStatementText),{color:b})},{children:te(i)}))}))]})),s.jsxs("div",e.__assign({style:y.styles.mrReminderDateFields},{children:[s.jsxs("div",e.__assign({style:y.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:y.styles.mrReminderFieldLabel},{children:le})),s.jsxs("div",e.__assign({style:y.styles.mrReminderDatePicker},{children:[s.jsx(a.LocalizationProvider,e.__assign({dateAdapter:o.AdapterDayjs},{children:s.jsx(a.DatePicker,{value:i.reminder_start_date?v.default(i.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&v.default(e).isValid()){if(v.default(e).isBefore(v.default(),"day"))return;We(t,v.default(e).toISOString())}else We(t,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:C,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:y.styles.mrIconArrow})]}))]})),s.jsxs("div",e.__assign({style:y.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:y.styles.mrReminderFieldLabel},{children:oe})),s.jsx("div",e.__assign({style:y.styles.mrReminderDueDate},{children:(null==u?void 0:u.due_at)?v.default(u.due_at).format("MM/DD/YYYY"):""}))]})),s.jsxs("div",e.__assign({style:y.styles.mrReminderField},{children:[s.jsx("p",e.__assign({style:y.styles.mrReminderFieldLabel},{children:ce})),s.jsxs("div",e.__assign({style:y.styles.mrReminderFrequency},{children:[s.jsx("span",e.__assign({style:y.styles.mrReminderFrequencyText},{children:"Every"})),s.jsx(d.default,{value:i.reminder_frequency,onChange:function(e){return function(e,s){ze(e,"reminder_frequency",s)}(t,e)},options:fe,suffix:"hours"})]}))]}))]})),s.jsxs("div",e.__assign({style:y.styles.mrEscalationCheckbox},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationCheckboxHeader},{children:[s.jsx(_.default,{size:"small",disableRipple:!0,checked:i.is_escalation_reminder,onChange:function(e){return function(e,s){ze(e,"is_escalation_reminder",s),s||(ze(e,"days",{type:"preset",value:""}),ze(e,"escalation_reminder_frequency",{type:"preset",value:""}),ze(e,"before_or_after",""))}(t,e.target.checked)},icon:s.jsx("div",{style:y.styles.mrCheckboxUnchecked}),checkedIcon:s.jsx("div",e.__assign({style:y.styles.mrCheckboxChecked},{children:s.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:y.styles.mrCheckboxIcon},{children:s.jsx("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),ye,s.jsx("div",e.__assign({style:y.styles.mrTooltipIcon},{children:s.jsx(n.InfoIcon,{stroke:"#64748B",style:y.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:y.styles.mrEscalationContent},{children:[s.jsx("div",e.__assign({style:y.styles.mrEscalationCondition},{children:_e})),s.jsxs("div",e.__assign({style:y.styles.mrEscalationFields},{children:[s.jsxs("div",e.__assign({style:y.styles.mrEscalationFieldGroup},{children:[s.jsx(d.default,{value:i.days,onChange:function(e){return function(e,s){ze(e,"days",s)}(t,e)}}),s.jsx("div",e.__assign({style:y.styles.mrEscalationFieldText},{children:ge}))]})),s.jsxs("div",e.__assign({style:e.__assign(e.__assign({},y.styles.mrEscalationFieldGroup),y.styles.mrEscalationFieldGroupLarge)},{children:[s.jsx(r.Autocomplete,{size:"small",options:Fe,value:i.before_or_after,onChange:function(e,s){return function(e,s){ze(e,"before_or_after",s)}(t,s||"")},popupIcon:s.jsx(n.ChevronDown,{style:y.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:C}))},sx:{width:"100%"}}),s.jsx("div",e.__assign({style:y.styles.mrEscalationFieldText},{children:xe}))]})),s.jsx("div",e.__assign({style:y.styles.mrEscalationFieldGroupSmall},{children:s.jsx(d.default,{value:i.escalation_reminder_frequency,onChange:function(e){return function(e,s){ze(e,"escalation_reminder_frequency",s)}(t,e)},options:be,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))})}))}))}))]})),Ae&&s.jsxs(l.motion.div,e.__assign({initial:{width:Me?"345px":"43px"},animate:{width:Me?"345px":"43px"},transition:{duration:.3},style:y.styles.mrCalendarPanel},{children:[Me?s.jsx(c.default,{assignees:m}):s.jsx("div",e.__assign({style:y.styles.mrCalendarCollapsed},{children:s.jsx(n.CalendarIcon,{style:y.styles.mrIconCalendar})})),s.jsxs("button",e.__assign({onClick:function(){return Oe(function(e){return!e})},style:y.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"})})),Me?s.jsx(n.ChevronRight,{style:y.styles.mrIconChevronToggle}):s.jsx(n.ChevronLeft,{style:y.styles.mrIconChevronToggle})]}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=ManageReminders.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as r}from"react/jsx-runtime";import{Bell as a,ClipboardList as o,X as l,CircleAlert as d}from"lucide-react";import s,{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:[t("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),t("circle",{cx:"9",cy:"7",r:"4"}),t("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),t("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:t(a,{size:15})},{tabName:"Review Status",tabIcon:t(o,{size:15})}],_=[{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 L(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 t=e.find(function(e){return e.isHidden}),r=i.find(function(e){return e.isHidden}),a=e.filter(function(e){return!e.isHidden}),o=t||r,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,t,r;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!==(t=e.status)&&void 0!==t?t:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(r=e.assignees)&&void 0!==r?r:[]).map(function(e){var n,i,t,r,a,o,l,d,s,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(t=e.email)&&void 0!==t?t:"",accessLevel:null!==(a=null!==(r=e.accessLevel)&&void 0!==r?r: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!==(d=e.notes)&&void 0!==d?d:"",sendMailNow:!!e.sendMailNow,action:null!==(s=e.action)&&void 0!==s?s:"",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 t=n.getFullYear(),r=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(a)},q=function(e,n,i){return(null==e?void 0:e.name)||(null==n?void 0:n.email)||(null==i?void 0:i.email)||"Owner"};function B(a){var o,N,B=a.metadata,x=void 0===B?{}:B,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,te=a.isOwner,re=void 0===te||te,ae=a.ownerDetails,oe=a.blockEditScreen,le=void 0!==oe&&oe,de=a.hideManageReminders,se=void 0!==de&&de,ue=a.hideClearButton,ce=void 0!==ue&&ue,ve=a.hideSaveChangesButton,me=void 0!==ve&&ve,pe=a.hideFooterActions,fe=void 0!==pe&&pe;a.hideAssigneeApproverScreen,a.remindersData;var ye=a.remainderOwners,he=a.setRemainderOwners,be=a.schedules,De=a.setSchedules,ge=a.handelSendNow,we=a.showPreviewEmail,Ae=a.tabName,_e=a.reminderLabels,Le=a.reminderColors,Re=a.reminderChipColor,Se=a.reminderAssignees,Te=a.reminderFallbackRecipients,Ne=a.reminderRecipientsColor,Ce=a.manualReminderTitle,Fe=a.manualReminderDescription,Me=a.lastReminderText,qe=a.selectRecipientsLabel,Be=a.previewEmailButtonLabel,xe=a.sendNowButtonLabel,Oe=a.reminderSuccessTitle,ke=a.reminderSuccessDescription,He=a.escalationTitle,je=a.escalationTitleTooltip,Ie=a.escalationDescription,Pe=a.configureAutoReminderText,Ee=a.getDynamicStatement,We=a.reminderStartDateLabel,ze=a.documentDueDateLabel,Ve=a.reminderFrequencyLabel,Ue=a.escalationRemindersLabel,Je=a.escalationTooltip,Ye=a.escalationConditionText,Ge=a.daysText,Ke=a.dueDataAndRepeatText,Qe=a.reminderFrequencyOptions,Xe=a.escalationFrequencyOptions,Ze=a.beforeAfterOptions,$e=s.useMemo(function(){var e;return(null===(e=x.tabData)||void 0===e?void 0:e.length)?x.tabData:A},[x.tabData]),en=s.useMemo(function(){return $e.filter(function(e){var n=L(e.tabName);return!((!re||le)&&"assignees"===n)&&(!se||"reminders"!==n)})},[$e,re,le,se]),nn=u(null!==(N=null===(o=en[0])||void 0===o?void 0:o.tabName)&&void 0!==N?N:""),tn=nn[0],rn=nn[1],an=L(tn),on=s.useMemo(function(){return T(H||w)},[]),ln=u(on),dn=ln[0],sn=ln[1],un=u(I||!1),cn=un[0],vn=un[1],mn=u(E||null),pn=mn[0],fn=mn[1],yn=s.useRef(!1),hn=s.useRef(!1),bn=s.useRef(!1),Dn=s.useRef(C(on)),gn=s.useRef(!!I),wn=s.useRef(F(E||null)),An=s.useCallback(function(e){yn.current=!0,sn(e)},[]),_n=s.useCallback(function(e){hn.current=!0,vn(e)},[]),Ln=s.useCallback(function(e){bn.current=!0,fn(e)},[]),Rn=u(null),Sn=Rn[0],Tn=Rn[1],Nn=u([]),Cn=Nn[0],Fn=Nn[1],Mn=u(ye||_),qn=Mn[0],Bn=Mn[1],xn=void 0!==be?be:Cn,On=void 0!==De?De:Fn,kn=void 0!==ye?ye:qn,Hn=function(){return h(new Date)},jn=s.useMemo(function(){return{due_at:pn?pn.toISOString():"",assignee:dn.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,t){var r;return e(e({},n),((r={})[t]=i,r))},{})}},[pn,dn]);c(function(){void 0!==ye&&Bn(ye)},[ye]),c(function(){ie&&ie().then(function(e){Array.isArray(e)&&e.length>0?Tn(e[0]):e&&!Array.isArray(e)&&Tn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),c(function(){Ae&&en.some(function(e){return e.tabName===Ae})&&rn(Ae)},[Ae,en]),c(function(){var e,n;en.some(function(e){return e.tabName===tn})||rn(null!==(n=null===(e=en[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[en,tn]),c(function(){if(H){var e=T(H,dn),n=C(e),i=C(dn);n!==Dn.current&&(yn.current&&n!==i||(Dn.current=n,yn.current=!1,n!==i&&sn(e)))}},[H,dn]),c(function(){if(void 0!==I){var e=!!I;e!==gn.current&&(hn.current&&e!==cn||(gn.current=e,hn.current=!1,e!==cn&&vn(e)))}},[I,cn]),c(function(){if(void 0!==E){var e=null!=E?E:null,n=F(e),i=F(pn);n!==wn.current&&(bn.current&&n!==i||(wn.current=n,bn.current=!1,n!==i&&fn(e)))}},[E,pn]),c(function(){sn(function(i){var t,r=i.filter(function(e){return!e.isHidden}),a=i.find(function(e){return e.isHidden});if(cn){var o=null===(t=null==a?void 0:a.assignees)||void 0===t?void 0:t[0],l=e(e({},o),{id:(null==o?void 0:o.id)||(null==Sn?void 0:Sn.id)||"me",email:(null==o?void 0:o.email)||(null==Sn?void 0:Sn.email)||"",name:q(ae,o,Sn),accessLevel:(null==o?void 0:o.accessLevel)||"Approve",role:(null==o?void 0:o.role)||"Final Approver"}),d=e(e({},a),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[l]});return S(n(n([],r,!0),[d],!1))}return S(r)})},[cn,Sn]),c(function(){var e=dn.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});Bn(function(n){var i=n.length===e.length&&e.every(function(e,i){var t;return(null===(t=n[i])||void 0===t?void 0:t.email)===e.email});return i?n:e.map(function(e,i){var t=n.find(function(n){return n.email===e.email});return t||{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:""}}})})},[dn]);var In=dn.filter(function(e){return!e.isHidden}),Pn=f(In),En=Pn&&Pn>Hn()?Pn:Hn(),Wn=In.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,t=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!t}),zn=!1!==x.showFinalApprovalDueDate,Vn=!!Wn||zn&&!pn,Un=y(In,pn),Jn=$||Vn||!!Un,Yn=x.wrapperTitle||"Assign Redline and Manage Reminders",Gn=x.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Kn=x.wrapperPriority||"High",Qn=x.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return t("div",e({style:e(e({},g.overlay),X.overlay)},{children:i("div",e({style:e(e(e({},g.modal),"reminders"===an?{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:[t("span",e({style:e(e({},g.modalTitle),X.modalTitle)},{children:Yn})),i("div",e({style:e(e({},g.redlineRow),X.redlineRow)},{children:[t("span",e({style:e(e({},g.redlineName),X.redlineName)},{children:Gn})),t("span",e({style:e(e(e({},g.redlineBadge),Qn),X.redlineBadge)},{children:Kn}))]}))]})),t("button",e({style:e(e({},g.closeBtn),X.closeBtn),onClick:z},{children:t(l,{size:20,color:"#6B7280"})}))]})),t("div",e({style:e(e({},g.tabBar),X.tabBar)},{children:en.map(function(n){var t=tn===n.tabName;return i("button",e({style:e(e(e({},g.tab),X.tab),t?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"===an&&i(r,{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"," ",t("sup",e({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),t("div",e({style:e(e({},g.dueDateInputWrap),X.dueDateInputWrap)},{children:t(p,{value:M(pn),onChange:function(e){var n="function"==typeof e?e(pn):e;n&&h(n)<En?null==J||J("Final approval due date cannot be before the latest level due date"):Ln(n?b(n):null)},minDate:En,disabled:null==ne?void 0:ne.disableDueDates})})),i("span",e({style:e(e({},g.requiredToProceeed),X.requiredToProceeed)},{children:[t(d,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),t(v,{levels:dn,totalLevels:K,requireFinalApproval:cn,setLevels:An,setRequireFinalApproval:function(e){_n(e)},fetchUsers:V,onValidationError:J,customStyles:X,finalApprovalDueDate:pn,displayConfig:ne})]}),"reminders"===an&&t(D,e({data:jn,schedules:xn,setSchedules:On,remainderOwners:kn,setRemainderOwners:function(e){var n="function"==typeof e?e(kn):e;he?he(n):Bn(n)},handelSendNow:function(e,n){ge&&ge(e||xn,n||kn)},showPreviewEmail:null!=we&&we},void 0!==_e&&{labels:_e},void 0!==Le&&{colors:Le},void 0!==Re&&{chipColor:Re},void 0!==Se&&{assignees:Se},void 0!==Te&&{fallbackRecipients:Te},void 0!==Ne&&{recipientsColor:Ne},void 0!==Ce&&{manualReminderTitle:Ce},void 0!==Fe&&{manualReminderDescription:Fe},void 0!==Me&&{lastReminderText:Me},void 0!==qe&&{selectRecipientsLabel:qe},void 0!==Be&&{previewEmailButtonLabel:Be},void 0!==xe&&{sendNowButtonLabel:xe},void 0!==Oe&&{reminderSuccessTitle:Oe},void 0!==ke&&{reminderSuccessDescription:ke},void 0!==He&&{escalationTitle:He},void 0!==je&&{escalationTitleTooltip:je},void 0!==Ie&&{escalationDescription:Ie},void 0!==Pe&&{configureAutoReminderText:Pe},void 0!==Ee&&{getDynamicStatement:Ee},void 0!==We&&{reminderStartDateLabel:We},void 0!==ze&&{documentDueDateLabel:ze},void 0!==Ve&&{reminderFrequencyLabel:Ve},void 0!==Ue&&{escalationRemindersLabel:Ue},void 0!==Je&&{escalationTooltip:Je},void 0!==Ye&&{escalationConditionText:Ye},void 0!==Ge&&{daysText:Ge},void 0!==Ke&&{dueDataAndRepeatText:Ke},void 0!==Qe&&{reminderFrequencyOptions:Qe},void 0!==Xe&&{escalationFrequencyOptions:Xe},void 0!==Ze&&{beforeAfterOptions:Ze})),"review"===an&&t(m,{levels:dn,reviewData:k,showApproveAndMoveToNextLevelButton:Y,onApproveAndMoveToNextLevel:G})]})),!fe&&(!ce||!me)&&i("div",e({style:e(e({},g.footer),X.footer)},{children:[!ce&&t("button",e({style:e(e(e({},g.clearBtn),X.clearBtn),$?X.actionBtnDisabled:{}),onClick:function(){An(R(w.map(function(n){return e(e({},n),{assignees:[],dueDate:null})}))),_n(!1),Ln(null)},disabled:$},{children:"Clear"})),!me&&t("button",e({style:e(e(e({},g.saveBtn),X.saveBtn),Jn?e({opacity:.55,cursor:"not-allowed"},X.actionBtnDisabled):{}),onClick:function(){if(Jn)$||null==J||J(Un||function(){if(zn&&!pn)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=S(dn.filter(function(e){return!e.isHidden}));null==j||j(e),null==P||P(cn),null==W||W(pn),null==U||U({levels:e,requireFinalApproval:cn,finalApprovalDueDate:pn,activeTab:an,schedules:xn,remainderOwners:kn})}},disabled:Jn},{children:"Save Changes"}))]}))]}))}))}export{B as AssignReminderWrapper,w as INITIAL_LEVELS};
|
|
1
|
+
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as r}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{getLatestLevelDueDate as p,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:[t("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),t("circle",{cx:"9",cy:"7",r:"4"}),t("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),t("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:t(a,{size:15})},{tabName:"Review Status",tabIcon:t(o,{size:15})}],_=[{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 L(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 t=e.find(function(e){return e.isHidden}),r=i.find(function(e){return e.isHidden}),a=e.filter(function(e){return!e.isHidden}),o=t||r,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,t,r;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!==(t=e.status)&&void 0!==t?t:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(r=e.assignees)&&void 0!==r?r:[]).map(function(e){var n,i,t,r,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!==(t=e.email)&&void 0!==t?t:"",accessLevel:null!==(a=null!==(r=e.accessLevel)&&void 0!==r?r: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 t=n.getFullYear(),r=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(a)},q=function(e,n,i){return(null==e?void 0:e.name)||(null==n?void 0:n.email)||(null==i?void 0:i.email)||"Owner"};function B(a){var o,N,B=a.metadata,x=void 0===B?{}:B,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,te=a.isOwner,re=void 0===te||te,ae=a.ownerDetails,oe=a.blockEditScreen,le=void 0!==oe&&oe,se=a.hideManageReminders,de=void 0!==se&&se,ue=a.hideClearButton,ce=void 0!==ue&&ue,ve=a.hideSaveChangesButton,me=void 0!==ve&&ve,fe=a.hideFooterActions,pe=void 0!==fe&&fe;a.hideAssigneeApproverScreen,a.remindersData;var ye=a.remainderOwners,he=a.setRemainderOwners,be=a.schedules,De=a.setSchedules,ge=a.handelSendNow,we=a.showPreviewEmail,Ae=a.tabName,_e=a.reminderLabels,Le=a.reminderColors,Re=a.reminderChipColor,Se=a.reminderAssignees,Te=a.reminderFallbackRecipients,Ne=a.reminderRecipientsColor,Ce=a.manualReminderTitle,Fe=a.manualReminderDescription,Me=a.lastReminderText,qe=a.selectRecipientsLabel,Be=a.previewEmailButtonLabel,xe=a.sendNowButtonLabel,Oe=a.reminderSuccessTitle,ke=a.reminderSuccessDescription,He=a.escalationTitle,je=a.escalationTitleTooltip,Ie=a.escalationDescription,Pe=a.configureAutoReminderText,Ee=a.getDynamicStatement,We=a.reminderStartDateLabel,ze=a.documentDueDateLabel,Ve=a.reminderFrequencyLabel,Ue=a.escalationRemindersLabel,Je=a.escalationTooltip,Ye=a.escalationConditionText,Ge=a.daysText,Ke=a.dueDataAndRepeatText,Qe=a.reminderFrequencyOptions,Xe=a.escalationFrequencyOptions,Ze=a.beforeAfterOptions,$e=d.useMemo(function(){var e;return(null===(e=x.tabData)||void 0===e?void 0:e.length)?x.tabData:A},[x.tabData]),en=d.useMemo(function(){return $e.filter(function(e){var n=L(e.tabName);return!((!re||le)&&"assignees"===n)&&(!de||"reminders"!==n)})},[$e,re,le,de]),nn=u(null!==(N=null===(o=en[0])||void 0===o?void 0:o.tabName)&&void 0!==N?N:""),tn=nn[0],rn=nn[1],an=L(tn),on=d.useMemo(function(){return T(H||w)},[]),ln=u(on),sn=ln[0],dn=ln[1],un=u(I||!1),cn=un[0],vn=un[1],mn=u(E||null),fn=mn[0],pn=mn[1],yn=d.useRef(!1),hn=d.useRef(!1),bn=d.useRef(!1),Dn=d.useRef(C(on)),gn=d.useRef(!!I),wn=d.useRef(F(E||null)),An=d.useCallback(function(e){yn.current=!0,dn(e)},[]),_n=d.useCallback(function(e){hn.current=!0,vn(e)},[]),Ln=d.useCallback(function(e){bn.current=!0,pn(e)},[]),Rn=u(null),Sn=Rn[0],Tn=Rn[1],Nn=u([]),Cn=Nn[0],Fn=Nn[1],Mn=u(ye||_),qn=Mn[0],Bn=Mn[1],xn=void 0!==be?be:Cn,On=void 0!==De?De:Fn,kn=void 0!==ye?ye:qn,Hn=function(){return h(new Date)},jn=d.useMemo(function(){return{due_at:fn?fn.toISOString():"",assignee:sn.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,t){var r;return e(e({},n),((r={})[t]=i,r))},{})}},[fn,sn]);c(function(){void 0!==ye&&Bn(ye)},[ye]),c(function(){ie&&ie().then(function(e){Array.isArray(e)&&e.length>0?Tn(e[0]):e&&!Array.isArray(e)&&Tn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),c(function(){Ae&&en.some(function(e){return e.tabName===Ae})&&rn(Ae)},[Ae,en]),c(function(){var e,n;en.some(function(e){return e.tabName===tn})||rn(null!==(n=null===(e=en[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[en,tn]),c(function(){if(H){var e=T(H,sn),n=C(e),i=C(sn);n!==Dn.current&&(yn.current&&n!==i||(Dn.current=n,yn.current=!1,n!==i&&dn(e)))}},[H,sn]),c(function(){if(void 0!==I){var e=!!I;e!==gn.current&&(hn.current&&e!==cn||(gn.current=e,hn.current=!1,e!==cn&&vn(e)))}},[I,cn]),c(function(){if(void 0!==E){var e=null!=E?E:null,n=F(e),i=F(fn);n!==wn.current&&(bn.current&&n!==i||(wn.current=n,bn.current=!1,n!==i&&pn(e)))}},[E,fn]),c(function(){dn(function(i){var t,r=i.filter(function(e){return!e.isHidden}),a=i.find(function(e){return e.isHidden});if(cn){var o=null===(t=null==a?void 0:a.assignees)||void 0===t?void 0:t[0],l=e(e({},o),{id:(null==o?void 0:o.id)||(null==Sn?void 0:Sn.id)||"me",email:(null==o?void 0:o.email)||(null==Sn?void 0:Sn.email)||"",name:q(ae,o,Sn),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([],r,!0),[s],!1))}return S(r)})},[cn,Sn]),c(function(){var e=sn.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});Bn(function(n){var i=n.length===e.length&&e.every(function(e,i){var t;return(null===(t=n[i])||void 0===t?void 0:t.email)===e.email});return i?n:e.map(function(e,i){var t=n.find(function(n){return n.email===e.email});return t||{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:""}}})})},[sn]);var In=sn.filter(function(e){return!e.isHidden}),Pn=In.some(function(e){return(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})}),En=p(In),Wn=En&&En>Hn()?En:Hn(),zn=In.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,t=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!t}),Vn=!1!==x.showFinalApprovalDueDate,Un=!!zn||Vn&&!fn,Jn=y(In,fn),Yn=$||(null==ne?void 0:ne.disableSaveChanges)||!Pn||Un||!!Jn,Gn=x.wrapperTitle||"Assign Redline and Manage Reminders",Kn=x.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Qn=x.wrapperPriority||"High",Xn=x.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return t("div",e({style:e(e({},g.overlay),X.overlay)},{children:i("div",e({style:e(e(e({},g.modal),"reminders"===an?{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:[t("span",e({style:e(e({},g.modalTitle),X.modalTitle)},{children:Gn})),i("div",e({style:e(e({},g.redlineRow),X.redlineRow)},{children:[t("span",e({style:e(e({},g.redlineName),X.redlineName)},{children:Kn})),t("span",e({style:e(e(e({},g.redlineBadge),Xn),X.redlineBadge)},{children:Qn}))]}))]})),t("button",e({style:e(e({},g.closeBtn),X.closeBtn),onClick:z},{children:t(l,{size:20,color:"#6B7280"})}))]})),t("div",e({style:e(e({},g.tabBar),X.tabBar)},{children:en.map(function(n){var t=tn===n.tabName;return i("button",e({style:e(e(e({},g.tab),X.tab),t?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"===an&&i(r,{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"," ",t("sup",e({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),t("div",e({style:e(e({},g.dueDateInputWrap),X.dueDateInputWrap)},{children:t(f,{value:M(fn),onChange:function(e){var n="function"==typeof e?e(fn):e;n&&h(n)<Wn?null==J||J("Final approval due date cannot be before the latest level due date"):Ln(n?b(n):null)},minDate:Wn,disabled:null==ne?void 0:ne.disableDueDates})})),i("span",e({style:e(e({},g.requiredToProceeed),X.requiredToProceeed)},{children:[t(s,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),t(v,{levels:sn,totalLevels:K,requireFinalApproval:cn,setLevels:An,setRequireFinalApproval:function(e){_n(e)},fetchUsers:V,onValidationError:J,customStyles:X,finalApprovalDueDate:fn,displayConfig:ne})]}),"reminders"===an&&t(D,e({data:jn,schedules:xn,setSchedules:On,remainderOwners:kn,setRemainderOwners:function(e){var n="function"==typeof e?e(kn):e;he?he(n):Bn(n)},handelSendNow:function(e,n){ge&&ge(e||xn,n||kn)},showPreviewEmail:null!=we&&we},void 0!==_e&&{labels:_e},void 0!==Le&&{colors:Le},void 0!==Re&&{chipColor:Re},void 0!==Se&&{assignees:Se},void 0!==Te&&{fallbackRecipients:Te},void 0!==Ne&&{recipientsColor:Ne},void 0!==Ce&&{manualReminderTitle:Ce},void 0!==Fe&&{manualReminderDescription:Fe},void 0!==Me&&{lastReminderText:Me},void 0!==qe&&{selectRecipientsLabel:qe},void 0!==Be&&{previewEmailButtonLabel:Be},void 0!==xe&&{sendNowButtonLabel:xe},void 0!==Oe&&{reminderSuccessTitle:Oe},void 0!==ke&&{reminderSuccessDescription:ke},void 0!==He&&{escalationTitle:He},void 0!==je&&{escalationTitleTooltip:je},void 0!==Ie&&{escalationDescription:Ie},void 0!==Pe&&{configureAutoReminderText:Pe},void 0!==Ee&&{getDynamicStatement:Ee},void 0!==We&&{reminderStartDateLabel:We},void 0!==ze&&{documentDueDateLabel:ze},void 0!==Ve&&{reminderFrequencyLabel:Ve},void 0!==Ue&&{escalationRemindersLabel:Ue},void 0!==Je&&{escalationTooltip:Je},void 0!==Ye&&{escalationConditionText:Ye},void 0!==Ge&&{daysText:Ge},void 0!==Ke&&{dueDataAndRepeatText:Ke},void 0!==Qe&&{reminderFrequencyOptions:Qe},void 0!==Xe&&{escalationFrequencyOptions:Xe},void 0!==Ze&&{beforeAfterOptions:Ze})),"review"===an&&t(m,{levels:sn,reviewData:k,showApproveAndMoveToNextLevelButton:Y,onApproveAndMoveToNextLevel:G})]})),!pe&&(!ce||!me)&&i("div",e({style:e(e({},g.footer),X.footer)},{children:[!ce&&t("button",e({style:e(e(e({},g.clearBtn),X.clearBtn),$?X.actionBtnDisabled:{}),onClick:function(){An(R(w.map(function(n){return e(e({},n),{assignees:[],dueDate:null})}))),_n(!1),Ln(null)},disabled:$},{children:"Clear"})),!me&&t("button",e({style:e(e(e({},g.saveBtn),X.saveBtn),Yn?e({opacity:.55,cursor:"not-allowed"},X.actionBtnDisabled):{}),onClick:function(){if(Yn)$||null==J||J(Jn||function(){if(!Pn)return"Please select at least one user before saving";if(Vn&&!fn)return"Final approval due date is required";if(!zn)return"Please fill all required fields before saving";var e=In.indexOf(zn)+1,n=[zn.dueDate?null:"due date",(zn.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(sn.filter(function(e){return!e.isHidden}));null==j||j(e),null==P||P(cn),null==W||W(fn),null==U||U({levels:e,requireFinalApproval:cn,finalApprovalDueDate:fn,activeTab:an,schedules:xn,remainderOwners:kn})}},disabled:Yn},{children:"Save Changes"}))]}))]}))}))}export{B 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{LocalizationProvider as k,DatePicker as D}from"@mui/x-date-pickers";import{AdapterDayjs as R}from"@mui/x-date-pickers/AdapterDayjs";import E from"./components/ReminderFrequencyAutocomplete.js";import w from"./components/AssigneeCalendarView.js";import S from"dayjs";import{styles as _}from"./styles/ManageReminder.style.js";var I=["Assignee 1","Assignee 2","Assignee 3"],A=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],B=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],T=[{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")}],L=[{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"}],P=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"},M={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}},q=function(q){var Y=q.data,j=q.schedules,N=q.setSchedules,H=q.remainderOwners,z=q.setRemainderOwners,W=q.labels,G=void 0===W?I:W,V=q.colors,U=void 0===V?A:V,J=q.chipColor,Z=void 0===J?B:J,K=q.assignees,Q=void 0===K?T:K,X=q.fallbackRecipients,$=void 0===X?O:X,ee=q.recipientsColor,ie=void 0===ee?L:ee,ne=q.manualReminderTitle,te=void 0===ne?"Send Manual Reminder Now":ne,re=q.manualReminderDescription,oe=void 0===re?"Immediately notify the assignees about this document.":re;q.lastReminderText;var le=q.selectRecipientsLabel,de=void 0===le?"Select recipients:":le,ae=q.previewEmailButtonLabel,se=void 0===ae?"Preview Email":ae,ce=q.sendNowButtonLabel,ue=void 0===ce?"Send Now":ce,me=q.reminderSuccessTitle,ve=void 0===me?"Reminder sent successfully!":me,he=q.reminderSuccessDescription,ye=void 0===he?"Email notification sent to assignees.":he,pe=q.escalationTitle,fe=void 0===pe?"Escalation and Auto Reminder Setup":pe;q.escalationTitleTooltip;var ge=q.escalationDescription,be=void 0===ge?"Configure Auto reminder settings for all assignees.":ge;q.configureAutoReminderText;var xe=q.getDynamicStatement,Ce=void 0===xe?P:xe,Fe=q.reminderStartDateLabel,ke=void 0===Fe?"Reminder Start Date":Fe,De=q.documentDueDateLabel,Re=void 0===De?"Document Due Date":De,Ee=q.reminderFrequencyLabel,we=void 0===Ee?"Reminder Frequency":Ee,Se=q.escalationRemindersLabel,_e=void 0===Se?"Escalation Reminders":Se;q.escalationTooltip;var Ie=q.escalationConditionText,Ae=void 0===Ie?"If the document is still pending, start escalation reminders":Ie,Be=q.daysText,Te=void 0===Be?"days":Be,Le=q.dueDataAndRepeatText,Oe=void 0===Le?"due date and repeat every":Le,Pe=q.reminderFrequencyOptions,Me=void 0===Pe?["12 hours","24 hours","48 hours","72 hours","Custom"]:Pe,qe=q.escalationFrequencyOptions,Ye=void 0===qe?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:qe,je=q.beforeAfterOptions,Ne=void 0===je?["After","Before"]:je,He=q.handelSendNow,ze=q.showPreviewEmail,We=void 0===ze||ze,Ge=t(!1),Ve=Ge[0],Ue=Ge[1],Je=t(!1),Ze=Je[0],Ke=Je[1],Qe=t(!1),Xe=Qe[0],$e=Qe[1],ei=t(!0),ii=ei[0],ni=ei[1],ti=t($),ri=ti[0],oi=ti[1];b();var li=function(i,n,t){z(function(r){return r.map(function(r,o){var l;return o===i?e(e({},r),((l={})[n]=t,l)):r})})},di=function(e,i){li(e,"reminder_start_date",i)},ai=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},si=function(e,i,n){if(!e||!n)return[];var t=ai(n);if(!t||t<=0)return[];for(var r=[],o=S(e).valueOf(),l=i?S(i).valueOf():S(e).add(45,"day").valueOf(),d=0;o<=l&&d<150;)r.push(S(o).toISOString()),o+=t,d++;return r},ci=function(e,i,n,t){if(!(e&&i&&t&&n))return[];var r=ai(t);if(!r)return[];var o,l=S(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(s).toISOString()),s+=r;return a},ui=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};r(function(){var e=(null==Y?void 0:Y.due_at)||"",i=Object.values((null==Y?void 0:Y.assignee)||{}),n=null==H?void 0:H.map(function(n,t){var r,o=i[t]||Q.find(function(e){return e.id===String(n.id)}),l=(null===(r=null==U?void 0:U[t%U.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:si(n.reminder_start_date,e,n.reminder_frequency),escalations:ci(e,n.days,n.before_or_after,n.escalation_reminder_frequency)}});N(n)},[H,null==Y?void 0:Y.due_at,null==Y?void 0:Y.assignee]),r(function(){(null==Y?void 0:Y.assignee)&&oi(function(e){var i=Object.values(Y.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==ie?void 0:ie[n])||L[n%L.length]}});return i.length>0?i:$})},[null==Y?void 0:Y.assignee,null==Y?void 0:Y.due_at]);var mi=Object.values((null==Y?void 0:Y.assignee)||{}).filter(function(e){return null==e?void 0:e.name});return i("div",e({style:e(e({},_.mrContainer),{width:"100%",minWidth:"850px"})},{children:[i("div",e({style:_.mrSectionBox},{children:[i("div",e({style:e(e({},_.mrSectionHeader),{cursor:"pointer"}),onClick:function(){Ve||Ue(!0)}},{children:[i("div",e({style:_.mrSectionHeaderContent},{children:[i("div",e({style:_.mrSectionHeaderLeft},{children:[i("div",e({style:_.mrSectionTitleWrapper},{children:[n("div",e({style:_.mrSectionTitleIcon},{children:n(o,{style:_.mrIconSmall})})),n("div",e({style:_.mrSectionTitle},{children:te}))]})),n("div",e({style:_.mrSectionDescription},{children:oe}))]})),n("div",e({style:_.mrSectionHeaderRight},{children:n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Ue(function(e){return!e})},style:_.mrChevronButton},{children:n(l,{style:e(e({},_.mrChevronIcon),Ve?_.mrChevronRotated:{})})}))}))]})),n(x,{children:Xe&&i(C.div,e({initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:_.mrSuccessMessage},{children:[n("div",e({style:_.mrSuccessIcon},{children:n("div",e({style:_.mrSuccessIconInner},{children:n(d,{style:_.mrIconSuccess})}))})),i("div",e({style:_.mrSuccessText},{children:[n("div",e({style:_.mrSuccessTitle},{children:ve})),n("div",e({style:_.mrSuccessDescription},{children:ye}))]}))]}))})]})),n(x,{children:Ve&&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({},_.mrHiddenSection),{pointerEvents:Ve?"auto":"none"})},{children:[i("div",e({style:_.mrRecipientsSection},{children:[n("div",e({style:_.mrRecipientsLabel},{children:de})),n("div",e({style:_.mrRecipientsGrid},{children:ri.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=L[r%L.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=L[r%L.length])||void 0===a?void 0:a.text)||"#1E40AF";return i("div",e({style:_.mrRecipientItem},{children:[n(h,{checked:t.checked,onChange:function(){return i=t.name,void oi(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:_.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:_.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.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:_.mrRecipientInfo},{children:[n("div",e({style:e(e({},_.mrRecipientAvatar),{backgroundColor:s,color:c})},{children:ui(t.name)})),n("div",e({style:_.mrRecipientName},{children:t.name}))]}))]}),t.name)})}))]})),i("div",e({style:_.mrActionsSection},{children:[We&&i("button",e({onClick:function(e){e.stopPropagation()},type:"button",style:e(e({},_.mrActionButton),_.mrActionButtonSecondary)},{children:[n(a,{style:_.mrIconAction}),se]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),$e(!0),setTimeout(function(){return $e(!1)},3e3);var i=ri.filter(function(e){return e.checked});He(j,H.filter(function(e){return i.some(function(i){return i.id===e.id})}))},style:e(e({},_.mrActionButton),_.mrActionButtonPrimary)},{children:ue}))]}))]}))})]})),i("div",e({style:_.mrMainContent},{children:[i("div",e({style:_.mrEscalationContainer},{children:[i("div",e({style:_.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Ze||Ke(!0)}},{children:[i("div",e({style:_.mrEscalationHeader},{children:[i("div",e({style:_.mrEscalationTitleWrapper},{children:[n("div",e({style:_.mrEscalationTitleText},{children:fe})),n("div",e({style:_.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:_.mrIconInfo})}))]})),i("div",e({style:_.mrEscalationActions},{children:[We&&i("button",e({style:_.mrEscalationPreviewButton},{children:[n("div",e({style:_.mrEscalationPreviewIcon},{children:n(a,{style:_.mrIconPreview})})),n("span",e({style:_.mrEscalationPreviewText},{children:se}))]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Ke(function(e){return!e})},style:_.mrChevronButton},{children:n(l,{style:e(e({},_.mrChevronIcon),Ze?_.mrChevronRotated:{})})}))]}))]})),n("div",e({style:_.mrEscalationDescription},{children:be}))]})),n(x,e({initial:!1},{children:Ze&&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:H||[],onReorder:function(e){z(e)},layoutScroll:!0,style:_.mrReorderGroup},{children:null==H?void 0:H.map(function(t,r){var o,d,a,u,m=mi[r]||$[r],v=(null===(o=null==U?void 0:U[r])||void 0===o?void 0:o.bg)||"#FDF2FA",b=(null===(d=null==U?void 0:U[r])||void 0===d?void 0:d.text)||"#C11574",F=(null===(a=null==Z?void 0:Z[r])||void 0===a?void 0:a.bg)||"transparent",w=(null===(u=null==Z?void 0:Z[r])||void 0===u?void 0:u.text)||"inherit";return i("div",e({style:_.mrReminderItem},{children:[n("div",e({style:_.mrReminderLabelBox},{children:n("div",e({style:_.mrReminderLabelInner},{children:n(y,{label:(null==G?void 0:G[r])||"Assignee ".concat(r+1),sx:{backgroundColor:v,minWidth:90,color:b,fontWeight:500}})}))})),i("div",e({style:_.mrReminderContent},{children:[n("div",{style:_.mrDragHandle}),n(p,e({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:_.mrReminderBox},{children:i("div",e({style:_.mrReminderFields},{children:[i("div",e({style:_.mrReminderHeader},{children:[i("div",e({style:_.mrReminderAssignee},{children:[n("div",e({style:_.mrReminderAvatar},{children:n("span",e({style:_.mrReminderInitials},{children:ui(null==m?void 0:m.name)}))})),n("span",e({style:_.mrReminderName},{children:null==m?void 0:m.name}))]})),n("div",e({style:e(e({},_.mrReminderStatement),{backgroundColor:F})},{children:n("span",e({style:e(e({},_.mrReminderStatementText),{color:w})},{children:Ce(t)}))}))]})),i("div",e({style:_.mrReminderDateFields},{children:[i("div",e({style:_.mrReminderField},{children:[n("p",e({style:_.mrReminderFieldLabel},{children:ke})),i("div",e({style:_.mrReminderDatePicker},{children:[n(k,e({dateAdapter:R},{children:n(D,{value:t.reminder_start_date?S(t.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&S(e).isValid()){if(S(e).isBefore(S(),"day"))return;di(r,S(e).toISOString())}else di(r,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:M,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:_.mrIconArrow})]}))]})),i("div",e({style:_.mrReminderField},{children:[n("p",e({style:_.mrReminderFieldLabel},{children:Re})),n("div",e({style:_.mrReminderDueDate},{children:(null==Y?void 0:Y.due_at)?S(Y.due_at).format("MM/DD/YYYY"):""}))]})),i("div",e({style:_.mrReminderField},{children:[n("p",e({style:_.mrReminderFieldLabel},{children:we})),i("div",e({style:_.mrReminderFrequency},{children:[n("span",e({style:_.mrReminderFrequencyText},{children:"Every"})),n(E,{value:t.reminder_frequency,onChange:function(e){return function(e,i){li(e,"reminder_frequency",i)}(r,e)},options:Me,suffix:"hours"})]}))]}))]})),i("div",e({style:_.mrEscalationCheckbox},{children:[i("div",e({style:_.mrEscalationCheckboxHeader},{children:[n(h,{size:"small",disableRipple:!0,checked:t.is_escalation_reminder,onChange:function(e){return function(e,i){li(e,"is_escalation_reminder",i),i||(li(e,"days",{type:"preset",value:""}),li(e,"escalation_reminder_frequency",{type:"preset",value:""}),li(e,"before_or_after",""))}(r,e.target.checked)},icon:n("div",{style:_.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:_.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.mrCheckboxIcon},{children:n("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),_e,n("div",e({style:_.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:_.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:_.mrEscalationContent},{children:[n("div",e({style:_.mrEscalationCondition},{children:Ae})),i("div",e({style:_.mrEscalationFields},{children:[i("div",e({style:_.mrEscalationFieldGroup},{children:[n(E,{value:t.days,onChange:function(e){return function(e,i){li(e,"days",i)}(r,e)}}),n("div",e({style:_.mrEscalationFieldText},{children:Te}))]})),i("div",e({style:e(e({},_.mrEscalationFieldGroup),_.mrEscalationFieldGroupLarge)},{children:[n(f,{size:"small",options:Ne,value:t.before_or_after,onChange:function(e,i){return function(e,i){li(e,"before_or_after",i)}(r,i||"")},popupIcon:n(l,{style:_.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:M}))},sx:{width:"100%"}}),n("div",e({style:_.mrEscalationFieldText},{children:Oe}))]})),n("div",e({style:_.mrEscalationFieldGroupSmall},{children:n(E,{value:t.escalation_reminder_frequency,onChange:function(e){return function(e,i){li(e,"escalation_reminder_frequency",i)}(r,e)},options:Ye,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))})}))}))}))]})),Ze&&i(C.div,e({initial:{width:ii?"345px":"43px"},animate:{width:ii?"345px":"43px"},transition:{duration:.3},style:_.mrCalendarPanel},{children:[ii?n(w,{assignees:j}):n("div",e({style:_.mrCalendarCollapsed},{children:n(u,{style:_.mrIconCalendar})})),i("button",e({onClick:function(){return ni(function(e){return!e})},style:_.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(ii?m:v,{style:_.mrIconChevronToggle})]}))]}))]}))]}))};export{q 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{LocalizationProvider as k,DatePicker as D}from"@mui/x-date-pickers";import{AdapterDayjs as R}from"@mui/x-date-pickers/AdapterDayjs";import E from"./components/ReminderFrequencyAutocomplete.js";import w from"./components/AssigneeCalendarView.js";import S from"dayjs";import{styles as _}from"./styles/ManageReminder.style.js";var I=["Assignee 1","Assignee 2","Assignee 3"],A=[{bg:"#FDF2FA",text:"#C11574"},{bg:"#EEF4FF",text:"#3538CD"},{bg:"#F1F5F9",text:"#344054"}],B=[{bg:"#FDF2FA",text:"#C93185"},{bg:"#EEF2FF",text:"#6366F1"},{bg:"#FFF4E5",text:"#FF6058"}],T=[{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")}],L=[{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"}],P=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"},M={"& .MuiInputBase-root":{height:"28px",borderRadius:"4px",fontSize:"11px"}},q=function(q){var Y=q.data,j=q.schedules,N=q.setSchedules,H=q.remainderOwners,z=q.setRemainderOwners,W=q.labels,G=void 0===W?I:W,V=q.colors,U=void 0===V?A:V,J=q.chipColor,Z=void 0===J?B:J,K=q.assignees,Q=void 0===K?T:K,X=q.fallbackRecipients,$=void 0===X?O:X,ee=q.recipientsColor,ie=void 0===ee?L:ee,ne=q.manualReminderTitle,te=void 0===ne?"Send Manual Reminder Now":ne,re=q.manualReminderDescription,oe=void 0===re?"Immediately notify the assignees about this document.":re;q.lastReminderText;var le=q.selectRecipientsLabel,de=void 0===le?"Select recipients:":le,ae=q.previewEmailButtonLabel,se=void 0===ae?"Preview Email":ae,ce=q.sendNowButtonLabel,ue=void 0===ce?"Send Now":ce,me=q.reminderSuccessTitle,ve=void 0===me?"Reminder sent successfully!":me,he=q.reminderSuccessDescription,ye=void 0===he?"Email notification sent to assignees.":he,pe=q.escalationTitle,fe=void 0===pe?"Escalation and Auto Reminder Setup":pe;q.escalationTitleTooltip;var ge=q.escalationDescription,be=void 0===ge?"Configure Auto reminder settings for all assignees.":ge;q.configureAutoReminderText;var xe=q.getDynamicStatement,Ce=void 0===xe?P:xe,Fe=q.reminderStartDateLabel,ke=void 0===Fe?"Reminder Start Date":Fe,De=q.documentDueDateLabel,Re=void 0===De?"Document Due Date":De,Ee=q.reminderFrequencyLabel,we=void 0===Ee?"Reminder Frequency":Ee,Se=q.escalationRemindersLabel,_e=void 0===Se?"Escalation Reminders":Se;q.escalationTooltip;var Ie=q.escalationConditionText,Ae=void 0===Ie?"If the document is still pending, start escalation reminders":Ie,Be=q.daysText,Te=void 0===Be?"days":Be,Le=q.dueDataAndRepeatText,Oe=void 0===Le?"due date and repeat every":Le,Pe=q.reminderFrequencyOptions,Me=void 0===Pe?["12 hours","24 hours","48 hours","72 hours","Custom"]:Pe,qe=q.escalationFrequencyOptions,Ye=void 0===qe?["1/2 hour","1 hour","4 hours","6 hours","12 hours","Custom"]:qe,je=q.beforeAfterOptions,Ne=void 0===je?["After","Before"]:je,He=q.handelSendNow,ze=q.showPreviewEmail,We=void 0===ze||ze,Ge=t(!1),Ve=Ge[0],Ue=Ge[1],Je=t(!1),Ze=Je[0],Ke=Je[1],Qe=t(!1),Xe=Qe[0],$e=Qe[1],ei=t(!0),ii=ei[0],ni=ei[1],ti=t($),ri=ti[0],oi=ti[1];b();var li=function(i,n,t){z(function(r){return r.map(function(r,o){var l;return o===i?e(e({},r),((l={})[n]=t,l)):r})})},di=function(e,i){li(e,"reminder_start_date",i)},ai=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},si=function(e,i,n){if(!e||!n)return[];var t=ai(n);if(!t||t<=0)return[];for(var r=[],o=S(e).valueOf(),l=i?S(i).valueOf():S(e).add(45,"day").valueOf(),d=0;o<=l&&d<150;)r.push(S(o).toISOString()),o+=t,d++;return r},ci=function(e,i,n,t){if(!(e&&i&&t&&n))return[];var r=ai(t);if(!r)return[];var o,l=S(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(s).toISOString()),s+=r;return a},ui=function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase():""};r(function(){var e=(null==Y?void 0:Y.due_at)||"",i=Object.values((null==Y?void 0:Y.assignee)||{}),n=null==H?void 0:H.map(function(n,t){var r,o=i[t]||Q.find(function(e){return e.id===String(n.id)}),l=(null===(r=null==U?void 0:U[t%U.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:si(n.reminder_start_date,e,n.reminder_frequency),escalations:ci(e,n.days,n.before_or_after,n.escalation_reminder_frequency)}});N(n)},[H,null==Y?void 0:Y.due_at,null==Y?void 0:Y.assignee]),r(function(){(null==Y?void 0:Y.assignee)&&oi(function(e){var i=Object.values(Y.assignee).filter(function(e){return e&&Object.keys(e).length>0}).map(function(i,n){var t,r,o=e.find(function(e){return e.name===i.name});return{id:null!==(t=i.id)&&void 0!==t?t:n+1,name:i.name,email:null!==(r=i.email)&&void 0!==r?r:"",checked:!!o&&o.checked,recipientsColor:(null==ie?void 0:ie[n])||L[n%L.length]}});return i.length>0?i:$})},[null==Y?void 0:Y.assignee,null==Y?void 0:Y.due_at]);var mi=Object.values((null==Y?void 0:Y.assignee)||{}).filter(function(e){return null==e?void 0:e.name}),vi=ri.filter(function(e){return e.checked}),hi=0===vi.length;return i("div",e({style:e(e({},_.mrContainer),{width:"100%",minWidth:"850px"})},{children:[i("div",e({style:_.mrSectionBox},{children:[i("div",e({style:e(e({},_.mrSectionHeader),{cursor:"pointer"}),onClick:function(){Ve||Ue(!0)}},{children:[i("div",e({style:_.mrSectionHeaderContent},{children:[i("div",e({style:_.mrSectionHeaderLeft},{children:[i("div",e({style:_.mrSectionTitleWrapper},{children:[n("div",e({style:_.mrSectionTitleIcon},{children:n(o,{style:_.mrIconSmall})})),n("div",e({style:_.mrSectionTitle},{children:te}))]})),n("div",e({style:_.mrSectionDescription},{children:oe}))]})),n("div",e({style:_.mrSectionHeaderRight},{children:n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Ue(function(e){return!e})},style:_.mrChevronButton},{children:n(l,{style:e(e({},_.mrChevronIcon),Ve?_.mrChevronRotated:{})})}))}))]})),n(x,{children:Xe&&i(C.div,e({initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:_.mrSuccessMessage},{children:[n("div",e({style:_.mrSuccessIcon},{children:n("div",e({style:_.mrSuccessIconInner},{children:n(d,{style:_.mrIconSuccess})}))})),i("div",e({style:_.mrSuccessText},{children:[n("div",e({style:_.mrSuccessTitle},{children:ve})),n("div",e({style:_.mrSuccessDescription},{children:ye}))]}))]}))})]})),n(x,{children:Ve&&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({},_.mrHiddenSection),{pointerEvents:Ve?"auto":"none"})},{children:[i("div",e({style:_.mrRecipientsSection},{children:[n("div",e({style:_.mrRecipientsLabel},{children:de})),n("div",e({style:_.mrRecipientsGrid},{children:ri.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=L[r%L.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=L[r%L.length])||void 0===a?void 0:a.text)||"#1E40AF";return i("div",e({style:_.mrRecipientItem},{children:[n(h,{checked:t.checked,onChange:function(){return i=t.name,void oi(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:_.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:_.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.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:_.mrRecipientInfo},{children:[n("div",e({style:e(e({},_.mrRecipientAvatar),{backgroundColor:s,color:c})},{children:ui(t.name)})),n("div",e({style:_.mrRecipientName},{children:t.name}))]}))]}),t.name)})}))]})),i("div",e({style:_.mrActionsSection},{children:[We&&i("button",e({onClick:function(e){e.stopPropagation()},type:"button",style:e(e({},_.mrActionButton),_.mrActionButtonSecondary)},{children:[n(a,{style:_.mrIconAction}),se]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),hi||($e(!0),setTimeout(function(){return $e(!1)},3e3),He(j,H.filter(function(e){return vi.some(function(i){return i.id===e.id||i.email===e.email||i.name===e.name})})))},disabled:hi,style:e(e(e({},_.mrActionButton),_.mrActionButtonPrimary),hi?{opacity:.55,cursor:"not-allowed"}:{})},{children:ue}))]}))]}))})]})),i("div",e({style:_.mrMainContent},{children:[i("div",e({style:_.mrEscalationContainer},{children:[i("div",e({style:_.mrEscalationHeaderWrapper,onClick:function(e){e.stopPropagation(),Ze||Ke(!0)}},{children:[i("div",e({style:_.mrEscalationHeader},{children:[i("div",e({style:_.mrEscalationTitleWrapper},{children:[n("div",e({style:_.mrEscalationTitleText},{children:fe})),n("div",e({style:_.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:_.mrIconInfo})}))]})),i("div",e({style:_.mrEscalationActions},{children:[We&&i("button",e({style:_.mrEscalationPreviewButton},{children:[n("div",e({style:_.mrEscalationPreviewIcon},{children:n(a,{style:_.mrIconPreview})})),n("span",e({style:_.mrEscalationPreviewText},{children:se}))]})),n("button",e({type:"button",onClick:function(e){e.stopPropagation(),Ke(function(e){return!e})},style:_.mrChevronButton},{children:n(l,{style:e(e({},_.mrChevronIcon),Ze?_.mrChevronRotated:{})})}))]}))]})),n("div",e({style:_.mrEscalationDescription},{children:be}))]})),n(x,e({initial:!1},{children:Ze&&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:H||[],onReorder:function(e){z(e)},layoutScroll:!0,style:_.mrReorderGroup},{children:null==H?void 0:H.map(function(t,r){var o,d,a,u,m=mi[r]||$[r],v=(null===(o=null==U?void 0:U[r])||void 0===o?void 0:o.bg)||"#FDF2FA",b=(null===(d=null==U?void 0:U[r])||void 0===d?void 0:d.text)||"#C11574",F=(null===(a=null==Z?void 0:Z[r])||void 0===a?void 0:a.bg)||"transparent",w=(null===(u=null==Z?void 0:Z[r])||void 0===u?void 0:u.text)||"inherit";return i("div",e({style:_.mrReminderItem},{children:[n("div",e({style:_.mrReminderLabelBox},{children:n("div",e({style:_.mrReminderLabelInner},{children:n(y,{label:(null==G?void 0:G[r])||"Assignee ".concat(r+1),sx:{backgroundColor:v,minWidth:90,color:b,fontWeight:500}})}))})),i("div",e({style:_.mrReminderContent},{children:[n("div",{style:_.mrDragHandle}),n(p,e({display:"flex",alignItems:"center",gap:2,border:"1px solid #E5E7EB",sx:{background:"#fff"},style:_.mrReminderBox},{children:i("div",e({style:_.mrReminderFields},{children:[i("div",e({style:_.mrReminderHeader},{children:[i("div",e({style:_.mrReminderAssignee},{children:[n("div",e({style:_.mrReminderAvatar},{children:n("span",e({style:_.mrReminderInitials},{children:ui(null==m?void 0:m.name)}))})),n("span",e({style:_.mrReminderName},{children:null==m?void 0:m.name}))]})),n("div",e({style:e(e({},_.mrReminderStatement),{backgroundColor:F})},{children:n("span",e({style:e(e({},_.mrReminderStatementText),{color:w})},{children:Ce(t)}))}))]})),i("div",e({style:_.mrReminderDateFields},{children:[i("div",e({style:_.mrReminderField},{children:[n("p",e({style:_.mrReminderFieldLabel},{children:ke})),i("div",e({style:_.mrReminderDatePicker},{children:[n(k,e({dateAdapter:R},{children:n(D,{value:t.reminder_start_date?S(t.reminder_start_date):null,disablePast:!0,format:"MM/DD/YYYY",onChange:function(e){if(e&&S(e).isValid()){if(S(e).isBefore(S(),"day"))return;di(r,S(e).toISOString())}else di(r,"")},slotProps:{actionBar:{actions:["clear"]},textField:{fullWidth:!0,size:"small",sx:M,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:_.mrIconArrow})]}))]})),i("div",e({style:_.mrReminderField},{children:[n("p",e({style:_.mrReminderFieldLabel},{children:Re})),n("div",e({style:_.mrReminderDueDate},{children:(null==Y?void 0:Y.due_at)?S(Y.due_at).format("MM/DD/YYYY"):""}))]})),i("div",e({style:_.mrReminderField},{children:[n("p",e({style:_.mrReminderFieldLabel},{children:we})),i("div",e({style:_.mrReminderFrequency},{children:[n("span",e({style:_.mrReminderFrequencyText},{children:"Every"})),n(E,{value:t.reminder_frequency,onChange:function(e){return function(e,i){li(e,"reminder_frequency",i)}(r,e)},options:Me,suffix:"hours"})]}))]}))]})),i("div",e({style:_.mrEscalationCheckbox},{children:[i("div",e({style:_.mrEscalationCheckboxHeader},{children:[n(h,{size:"small",disableRipple:!0,checked:t.is_escalation_reminder,onChange:function(e){return function(e,i){li(e,"is_escalation_reminder",i),i||(li(e,"days",{type:"preset",value:""}),li(e,"escalation_reminder_frequency",{type:"preset",value:""}),li(e,"before_or_after",""))}(r,e.target.checked)},icon:n("div",{style:_.mrCheckboxUnchecked}),checkedIcon:n("div",e({style:_.mrCheckboxChecked},{children:n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 10",fill:"none",style:_.mrCheckboxIcon},{children:n("path",{d:"M1 5L4.2 8L11 1",stroke:"#5925DC",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))})),sx:{padding:0}}),_e,n("div",e({style:_.mrTooltipIcon},{children:n(s,{stroke:"#64748B",style:_.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:_.mrEscalationContent},{children:[n("div",e({style:_.mrEscalationCondition},{children:Ae})),i("div",e({style:_.mrEscalationFields},{children:[i("div",e({style:_.mrEscalationFieldGroup},{children:[n(E,{value:t.days,onChange:function(e){return function(e,i){li(e,"days",i)}(r,e)}}),n("div",e({style:_.mrEscalationFieldText},{children:Te}))]})),i("div",e({style:e(e({},_.mrEscalationFieldGroup),_.mrEscalationFieldGroupLarge)},{children:[n(f,{size:"small",options:Ne,value:t.before_or_after,onChange:function(e,i){return function(e,i){li(e,"before_or_after",i)}(r,i||"")},popupIcon:n(l,{style:_.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:M}))},sx:{width:"100%"}}),n("div",e({style:_.mrEscalationFieldText},{children:Oe}))]})),n("div",e({style:_.mrEscalationFieldGroupSmall},{children:n(E,{value:t.escalation_reminder_frequency,onChange:function(e){return function(e,i){li(e,"escalation_reminder_frequency",i)}(r,e)},options:Ye,suffix:"hours"})}))]}))]}))})]}))]}))}))]}))]}))})}))}))}))]})),Ze&&i(C.div,e({initial:{width:ii?"345px":"43px"},animate:{width:ii?"345px":"43px"},transition:{duration:.3},style:_.mrCalendarPanel},{children:[ii?n(w,{assignees:j}):n("div",e({style:_.mrCalendarCollapsed},{children:n(u,{style:_.mrIconCalendar})})),i("button",e({onClick:function(){return ni(function(e){return!e})},style:_.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(ii?m:v,{style:_.mrIconChevronToggle})]}))]}))]}))]}))};export{q as ManageReminders};
|
|
2
2
|
//# sourceMappingURL=ManageReminders.js.map
|
|
@@ -1 +1 @@
|
|
|
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,EACd,YAAY,EAGZ,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,
|
|
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,EACd,YAAY,EAGZ,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,qBAuwB5B;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,gCA6lBtB,CAAC"}
|