@viswa-test/creative-workspace-ui-component 0.0.64 → 0.0.66
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/components/CustomDropdown.js +1 -1
- package/dist/cjs/components/AssignReminders/components/LevelData.js +1 -1
- package/dist/cjs/components/AssignReminders/components/ReviewStatus.js +1 -1
- package/dist/components/AssignReminders/AssignReminderWrapper.js +1 -1
- package/dist/components/AssignReminders/components/CustomDropdown.js +1 -1
- package/dist/components/AssignReminders/components/LevelData.js +1 -1
- package/dist/components/AssignReminders/components/ReviewStatus.js +1 -1
- package/dist/types/App.d.ts.map +1 -1
- package/dist/types/SocketPackage.test.d.ts +3 -0
- package/dist/types/SocketPackage.test.d.ts.map +1 -0
- package/dist/types/components/AssignReminders/AssignReminderWrapper.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/components/CustomDropdown.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/components/LevelData.d.ts.map +1 -1
- package/dist/types/components/AssignReminders/components/ReviewStatus.d.ts.map +1 -1
- package/dist/types/features/cws/CwsEvent.d.ts +13 -0
- package/dist/types/features/cws/CwsEvent.d.ts.map +1 -0
- package/dist/types/features/cws/CwsEventProvider.d.ts +10 -0
- package/dist/types/features/cws/CwsEventProvider.d.ts.map +1 -0
- package/dist/types/features/cws/SocketManager.d.ts +29 -0
- package/dist/types/features/cws/SocketManager.d.ts.map +1 -0
- package/dist/types/features/cws/index.d.ts +4 -0
- package/dist/types/features/cws/index.d.ts.map +1 -0
- package/dist/types/features/cws/useCwsEvent.d.ts +2 -0
- package/dist/types/features/cws/useCwsEvent.d.ts.map +1 -0
- package/package.json +6 -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"),s=require("./AssignReminderLevels.js"),r=require("./components/ReviewStatus.js"),t=require("./components/CustomDatePicker.js"),o=require("./ManageReminders.js"),l=require("./styles/AssignReminderWrapperStyles.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(a),_=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],c=[{tabName:"Assignees & Approvers",tabIcon:n.jsxs("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[n.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),n.jsx("circle",{cx:"9",cy:"7",r:"4"}),n.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),n.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:n.jsx(i.Bell,{size:15})},{tabName:"Review Status",tabIcon:n.jsx(i.ClipboardList,{size:15})}],v=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function p(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}exports.AssignReminderWrapper=function(d){var m,f,g=d.metadata,S=void 0===g?{}:g,E=d.reviewData,R=void 0===E?{}:E,A=d.levels,D=d.setLevels,y=d.requireFinalApproval,L=d.setRequireFinalApproval,h=d.approvalDueDate,b=d.setApprovalDueDate,T=d.onClose,N=d.fetchUsers,x=d.onSave,I=d.onValidationError,P=d.showApproveAndMoveToNextLevelButton,F=d.onApproveAndMoveToNextLevel,j=d.totalLevels,w=d.customStyles,M=void 0===w?{}:w,q=d.isSaving,C=void 0!==q&&q,B=d.displayConfig,W=void 0===B?{}:B,U=d.onRequireFinalApproval,Y=d.isOwner,G=void 0===Y||Y,O=d.blockEditScreen,k=void 0!==O&&O,H=d.hideManageReminders,z=void 0!==H&&H,V=d.hideClearButton,X=void 0!==V&&V,J=d.hideSaveChangesButton,K=void 0!==J&&J,Q=d.hideFooterActions,Z=void 0!==Q&&Q;d.hideAssigneeApproverScreen,d.remindersData;var $=d.remainderOwners,ee=d.setRemainderOwners,ne=d.schedules,ie=d.setSchedules,ae=d.handelSendNow,se=d.showPreviewEmail,re=d.tabName,te=d.reminderLabels,oe=d.reminderColors,le=d.reminderChipColor,de=d.reminderAssignees,ue=d.reminderFallbackRecipients,_e=d.reminderRecipientsColor,ce=d.manualReminderTitle,ve=d.manualReminderDescription,pe=d.lastReminderText,me=d.selectRecipientsLabel,fe=d.previewEmailButtonLabel,ge=d.sendNowButtonLabel,Se=d.reminderSuccessTitle,Ee=d.reminderSuccessDescription,Re=d.escalationTitle,Ae=d.escalationTitleTooltip,De=d.escalationDescription,ye=d.configureAutoReminderText,Le=d.getDynamicStatement,he=d.reminderStartDateLabel,be=d.documentDueDateLabel,Te=d.reminderFrequencyLabel,Ne=d.escalationRemindersLabel,xe=d.escalationTooltip,Ie=d.escalationConditionText,Pe=d.daysText,Fe=d.dueDataAndRepeatText,je=d.reminderFrequencyOptions,we=d.escalationFrequencyOptions,Me=d.beforeAfterOptions,qe=u.default.useMemo(function(){var e;return(null===(e=S.tabData)||void 0===e?void 0:e.length)?S.tabData:c},[S.tabData]),Ce=u.default.useMemo(function(){return qe.filter(function(e){var n=p(e.tabName);return!((!G||k)&&"assignees"===n)&&(!z||"reminders"!==n)})},[qe,G,k,z]),Be=a.useState(null!==(f=null===(m=Ce[0])||void 0===m?void 0:m.tabName)&&void 0!==f?f:""),We=Be[0],Ue=Be[1],Ye=p(We),Ge=a.useState(A||_),Oe=Ge[0],ke=Ge[1],He=a.useState(y||!1),ze=He[0],Ve=He[1],Xe=a.useState(h||null),Je=Xe[0],Ke=Xe[1],Qe=a.useState(null),Ze=Qe[0],$e=Qe[1],en=a.useState([]),nn=en[0],an=en[1],sn=a.useState($||v),rn=sn[0],tn=sn[1],on=void 0!==ne?ne:nn,ln=void 0!==ie?ie:an,dn=void 0!==$?$:rn,un=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e.__assign(e.__assign({},n),{isMandatory:!0,hasDueDate:!0})})},_n=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},cn=function(){return _n(new Date)},vn=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})})})})},pn=u.default.useMemo(function(){return{due_at:Je?Je.toISOString():"",assignee:Oe.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,a){var s;return e.__assign(e.__assign({},n),((s={})[a]=i,s))},{})}},[Je,Oe]);a.useEffect(function(){void 0!==$&&tn($)},[$]),a.useEffect(function(){U&&U().then(function(e){Array.isArray(e)&&e.length>0?$e(e[0]):e&&!Array.isArray(e)&&$e(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),a.useEffect(function(){re&&Ce.some(function(e){return e.tabName===re})&&Ue(re)},[re,Ce]),a.useEffect(function(){var e,n;Ce.some(function(e){return e.tabName===We})||Ue(null!==(n=null===(e=Ce[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[Ce,We]),a.useEffect(function(){A&&ke(function(n){var i=n.find(function(e){return e.isHidden}),a=i?e.__spreadArray(e.__spreadArray([],A,!0),[i],!1):A;return vn(un(a))})},[A]),a.useEffect(function(){void 0!==y&&Ve(y)},[y]),a.useEffect(function(){void 0!==h&&Ke(h)},[h]),a.useEffect(function(){ke(function(n){var i=n.filter(function(e){return!e.isHidden});if(ze){var a={headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[{id:(null==Ze?void 0:Ze.id)||"me",email:(null==Ze?void 0:Ze.email)||"",name:(null==Ze?void 0:Ze.name)?"".concat(Ze.name," (You)"):"Username (You)",accessLevel:"Approve",role:"Final Approver"}]};return vn(e.__spreadArray(e.__spreadArray([],i,!0),[a],!1))}return vn(i)})},[ze,Ze]),a.useEffect(function(){var e=Oe.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});tn(function(n){var i=n.length===e.length&&e.every(function(e,i){var 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:""}}})})},[Oe]);var mn=Oe.filter(function(e){return!e.isHidden}),fn=mn.reduce(function(e,n){if(!n.dueDate)return e;var i=_n(n.dueDate);return!e||i>e?i:e},null),gn=fn&&fn>cn()?fn:cn(),Sn=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}),En=!1!==S.showFinalApprovalDueDate,Rn=C||(!!Sn||En&&!Je),An=S.wrapperTitle||"Assign Redline and Manage Reminders",Dn=S.wrapperSubTitle||"Sec 4.1 - Technical Security Information",yn=S.wrapperPriority||"High",Ln=S.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return n.jsx("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.overlay),M.overlay)},{children:n.jsxs("div",e.__assign({style:e.__assign(e.__assign(e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===Ye?{width:"1400px",maxWidth:"95vw"}:{}),M.modal)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.header),M.header)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.headerLeft),M.headerLeft)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modalTitle),M.modalTitle)},{children:An})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineRow),M.redlineRow)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineName),M.redlineName)},{children:Dn})),n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineBadge),Ln),M.redlineBadge)},{children:yn}))]}))]})),n.jsx("button",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.closeBtn),M.closeBtn),onClick:T},{children:n.jsx(i.X,{size:20,color:"#6B7280"})}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabBar),M.tabBar)},{children:Ce.map(function(i){var a=We===i.tabName;return n.jsxs("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tab),M.tab),a?e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabActive),M.tabActive):{}),onClick:function(){return Ue(i.tabName)}},{children:[i.tabIcon," ",i.tabName]}),i.tabName)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.body),M.body)},{children:["assignees"===Ye&&n.jsxs(n.Fragment,{children:[!1!==S.showFinalApprovalDueDate&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateBar),M.dueDateBar)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateLabel),M.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({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateInputWrap),M.dueDateInputWrap)},{children:n.jsx(t.default,{value:Je?Je.toISOString().slice(0,10):"",onChange:function(e){var n="function"==typeof e?e(Je):e;n&&_n(n)<gn?null==I||I("Final approval due date cannot be before the latest level due date"):Ke(n?_n(n):null)},minDate:gn,disabled:W.disableDueDates})})),n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.requiredToProceeed),M.requiredToProceeed)},{children:[n.jsx(i.CircleAlert,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),n.jsx(s.AssignReminderLevels,{levels:Oe,totalLevels:j,requireFinalApproval:ze,setLevels:ke,setRequireFinalApproval:function(e){Ve(e)},fetchUsers:N,onValidationError:I,customStyles:M,finalApprovalDueDate:Je,displayConfig:W})]}),"reminders"===Ye&&n.jsx(o.ManageReminders,e.__assign({data:pn,schedules:on,setSchedules:ln,remainderOwners:dn,setRemainderOwners:function(e){var n="function"==typeof e?e(dn):e;ee?ee(n):tn(n)},handelSendNow:function(e,n){ae&&ae(e||on,n||dn)},showPreviewEmail:null!=se&&se},void 0!==te&&{labels:te},void 0!==oe&&{colors:oe},void 0!==le&&{chipColor:le},void 0!==de&&{assignees:de},void 0!==ue&&{fallbackRecipients:ue},void 0!==_e&&{recipientsColor:_e},void 0!==ce&&{manualReminderTitle:ce},void 0!==ve&&{manualReminderDescription:ve},void 0!==pe&&{lastReminderText:pe},void 0!==me&&{selectRecipientsLabel:me},void 0!==fe&&{previewEmailButtonLabel:fe},void 0!==ge&&{sendNowButtonLabel:ge},void 0!==Se&&{reminderSuccessTitle:Se},void 0!==Ee&&{reminderSuccessDescription:Ee},void 0!==Re&&{escalationTitle:Re},void 0!==Ae&&{escalationTitleTooltip:Ae},void 0!==De&&{escalationDescription:De},void 0!==ye&&{configureAutoReminderText:ye},void 0!==Le&&{getDynamicStatement:Le},void 0!==he&&{reminderStartDateLabel:he},void 0!==be&&{documentDueDateLabel:be},void 0!==Te&&{reminderFrequencyLabel:Te},void 0!==Ne&&{escalationRemindersLabel:Ne},void 0!==xe&&{escalationTooltip:xe},void 0!==Ie&&{escalationConditionText:Ie},void 0!==Pe&&{daysText:Pe},void 0!==Fe&&{dueDataAndRepeatText:Fe},void 0!==je&&{reminderFrequencyOptions:je},void 0!==we&&{escalationFrequencyOptions:we},void 0!==Me&&{beforeAfterOptions:Me})),"review"===Ye&&n.jsx(r.default,{levels:Oe,reviewData:R,showApproveAndMoveToNextLevelButton:P,onApproveAndMoveToNextLevel:F})]})),!Z&&(!X||!K)&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.footer),M.footer)},{children:[!X&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.clearBtn),M.clearBtn),C?M.actionBtnDisabled:{}),onClick:function(){ke(un(_.map(function(n){return e.__assign(e.__assign({},n),{assignees:[],dueDate:null})}))),Ve(!1),Ke(null)},disabled:C},{children:"Clear"})),!K&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},l.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.saveBtn),M.saveBtn),Rn?e.__assign({opacity:.55,cursor:"not-allowed"},M.actionBtnDisabled):{}),onClick:function(){if(Rn)C||null==I||I(function(){if(En&&!Je)return"Final approval due date is required";if(!Sn)return"Please fill all required fields before saving";var e=mn.indexOf(Sn)+1,n=[Sn.dueDate?null:"due date",(Sn.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=vn(Oe.filter(function(e){return!e.isHidden}));null==D||D(e),null==L||L(ze),null==b||b(Je),null==x||x({levels:e,requireFinalApproval:ze,finalApprovalDueDate:Je,activeTab:Ye,schedules:on,remainderOwners:dn})}},disabled:Rn},{children:"Save Changes"}))]}))]}))}))},exports.INITIAL_LEVELS=_;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("lucide-react"),a=require("react"),s=require("./AssignReminderLevels.js"),t=require("./components/ReviewStatus.js"),r=require("./components/CustomDatePicker.js"),l=require("./ManageReminders.js"),o=require("./styles/AssignReminderWrapperStyles.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(a),_=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],c=[{tabName:"Assignees & Approvers",tabIcon:n.jsxs("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[n.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),n.jsx("circle",{cx:"9",cy:"7",r:"4"}),n.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),n.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:n.jsx(i.Bell,{size:15})},{tabName:"Review Status",tabIcon:n.jsx(i.ClipboardList,{size:15})}],v=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function f(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}var m=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e.__assign(e.__assign({},n),{isMandatory:!0,hasDueDate:!0})})},p=function(n){return n.map(function(n){var i;return e.__assign(e.__assign({},n),{assignees:(null!==(i=n.assignees)&&void 0!==i?i:[]).map(function(n){var i=n.accessLevel||n.role||"";return e.__assign(e.__assign({},n),{role:i,accessLevel:i})})})})},g=function(n,i){void 0===n&&(n=_),void 0===i&&(i=[]);var a=n.find(function(e){return e.isHidden}),s=i.find(function(e){return e.isHidden}),t=n.filter(function(e){return!e.isHidden}),r=a||s,l=r?e.__spreadArray(e.__spreadArray([],t,!0),[r],!1):t;return p(m(l))},R=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();return Number.isFinite(i)?n.toISOString():""},S=function(e){return void 0===e&&(e=[]),JSON.stringify(e.map(function(e){var n,i,a,s;return{headerName:null!==(n=e.headerName)&&void 0!==n?n:"",title:null!==(i=e.title)&&void 0!==i?i:"",isMandatory:!!e.isMandatory,hasDueDate:!!e.hasDueDate,isHidden:!!e.isHidden,dueDate:R(e.dueDate),status:null!==(a=e.status)&&void 0!==a?a:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(s=e.assignees)&&void 0!==s?s:[]).map(function(e){var n,i,a,s,t,r,l,o,d,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(a=e.email)&&void 0!==a?a:"",accessLevel:null!==(t=null!==(s=e.accessLevel)&&void 0!==s?s:e.role)&&void 0!==t?t:"",role:null!==(l=null!==(r=e.role)&&void 0!==r?r:e.accessLevel)&&void 0!==l?l:"",notes:null!==(o=e.notes)&&void 0!==o?o:"",sendMailNow:!!e.sendMailNow,action:null!==(d=e.action)&&void 0!==d?d:"",action_taken_at:null!==(u=e.action_taken_at)&&void 0!==u?u:""}})}}))},E=function(e){return R(e)};exports.AssignReminderWrapper=function(d){var R,D,A=d.metadata,y=void 0===A?{}:A,L=d.reviewData,h=void 0===L?{}:L,b=d.levels,T=d.setLevels,N=d.requireFinalApproval,x=d.setRequireFinalApproval,I=d.approvalDueDate,P=d.setApprovalDueDate,M=d.onClose,j=d.fetchUsers,w=d.onSave,F=d.onValidationError,q=d.showApproveAndMoveToNextLevelButton,C=d.onApproveAndMoveToNextLevel,B=d.totalLevels,W=d.customStyles,U=void 0===W?{}:W,Y=d.isSaving,G=void 0!==Y&&Y,O=d.displayConfig,k=void 0===O?{}:O,H=d.onRequireFinalApproval,z=d.isOwner,V=void 0===z||z,J=d.blockEditScreen,X=void 0!==J&&J,K=d.hideManageReminders,Q=void 0!==K&&K,Z=d.hideClearButton,$=void 0!==Z&&Z,ee=d.hideSaveChangesButton,ne=void 0!==ee&&ee,ie=d.hideFooterActions,ae=void 0!==ie&&ie;d.hideAssigneeApproverScreen,d.remindersData;var se=d.remainderOwners,te=d.setRemainderOwners,re=d.schedules,le=d.setSchedules,oe=d.handelSendNow,de=d.showPreviewEmail,ue=d.tabName,_e=d.reminderLabels,ce=d.reminderColors,ve=d.reminderChipColor,fe=d.reminderAssignees,me=d.reminderFallbackRecipients,pe=d.reminderRecipientsColor,ge=d.manualReminderTitle,Re=d.manualReminderDescription,Se=d.lastReminderText,Ee=d.selectRecipientsLabel,De=d.previewEmailButtonLabel,Ae=d.sendNowButtonLabel,ye=d.reminderSuccessTitle,Le=d.reminderSuccessDescription,he=d.escalationTitle,be=d.escalationTitleTooltip,Te=d.escalationDescription,Ne=d.configureAutoReminderText,xe=d.getDynamicStatement,Ie=d.reminderStartDateLabel,Pe=d.documentDueDateLabel,Me=d.reminderFrequencyLabel,je=d.escalationRemindersLabel,we=d.escalationTooltip,Fe=d.escalationConditionText,qe=d.daysText,Ce=d.dueDataAndRepeatText,Be=d.reminderFrequencyOptions,We=d.escalationFrequencyOptions,Ue=d.beforeAfterOptions,Ye=u.default.useMemo(function(){var e;return(null===(e=y.tabData)||void 0===e?void 0:e.length)?y.tabData:c},[y.tabData]),Ge=u.default.useMemo(function(){return Ye.filter(function(e){var n=f(e.tabName);return!((!V||X)&&"assignees"===n)&&(!Q||"reminders"!==n)})},[Ye,V,X,Q]),Oe=a.useState(null!==(D=null===(R=Ge[0])||void 0===R?void 0:R.tabName)&&void 0!==D?D:""),ke=Oe[0],He=Oe[1],ze=f(ke),Ve=u.default.useMemo(function(){return g(b||_)},[]),Je=a.useState(Ve),Xe=Je[0],Ke=Je[1],Qe=a.useState(N||!1),Ze=Qe[0],$e=Qe[1],en=a.useState(I||null),nn=en[0],an=en[1],sn=u.default.useRef(!1),tn=u.default.useRef(!1),rn=u.default.useRef(!1),ln=u.default.useRef(S(Ve)),on=u.default.useRef(!!N),dn=u.default.useRef(E(I||null)),un=u.default.useCallback(function(e){sn.current=!0,Ke(e)},[]),_n=u.default.useCallback(function(e){tn.current=!0,$e(e)},[]),cn=u.default.useCallback(function(e){rn.current=!0,an(e)},[]),vn=a.useState(null),fn=vn[0],mn=vn[1],pn=a.useState([]),gn=pn[0],Rn=pn[1],Sn=a.useState(se||v),En=Sn[0],Dn=Sn[1],An=void 0!==re?re:gn,yn=void 0!==le?le:Rn,Ln=void 0!==se?se:En,hn=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},bn=function(){return hn(new Date)},Tn=u.default.useMemo(function(){return{due_at:nn?nn.toISOString():"",assignee:Xe.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,a){var s;return e.__assign(e.__assign({},n),((s={})[a]=i,s))},{})}},[nn,Xe]);a.useEffect(function(){void 0!==se&&Dn(se)},[se]),a.useEffect(function(){H&&H().then(function(e){Array.isArray(e)&&e.length>0?mn(e[0]):e&&!Array.isArray(e)&&mn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),a.useEffect(function(){ue&&Ge.some(function(e){return e.tabName===ue})&&He(ue)},[ue,Ge]),a.useEffect(function(){var e,n;Ge.some(function(e){return e.tabName===ke})||He(null!==(n=null===(e=Ge[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[Ge,ke]),a.useEffect(function(){if(b){var e=g(b,Xe),n=S(e),i=S(Xe);n!==ln.current&&(sn.current&&n!==i||(ln.current=n,sn.current=!1,n!==i&&Ke(e)))}},[b,Xe]),a.useEffect(function(){if(void 0!==N){var e=!!N;e!==on.current&&(tn.current&&e!==Ze||(on.current=e,tn.current=!1,e!==Ze&&$e(e)))}},[N,Ze]),a.useEffect(function(){if(void 0!==I){var e=null!=I?I:null,n=E(e),i=E(nn);n!==dn.current&&(rn.current&&n!==i||(dn.current=n,rn.current=!1,n!==i&&an(e)))}},[I,nn]),a.useEffect(function(){Ke(function(n){var i,a=n.filter(function(e){return!e.isHidden}),s=n.find(function(e){return e.isHidden});if(Ze){var t=null===(i=null==s?void 0:s.assignees)||void 0===i?void 0:i[0],r=e.__assign(e.__assign({},t),{id:(null==t?void 0:t.id)||(null==fn?void 0:fn.id)||"me",email:(null==t?void 0:t.email)||(null==fn?void 0:fn.email)||"",name:(null==t?void 0:t.name)||((null==fn?void 0:fn.name)?"".concat(fn.name," (You)"):"Username (You)"),accessLevel:(null==t?void 0:t.accessLevel)||"Approve",role:(null==t?void 0:t.role)||"Final Approver"}),l=e.__assign(e.__assign({},s),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[r]});return p(e.__spreadArray(e.__spreadArray([],a,!0),[l],!1))}return p(a)})},[Ze,fn]),a.useEffect(function(){var e=Xe.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});Dn(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:""}}})})},[Xe]);var Nn=Xe.filter(function(e){return!e.isHidden}),xn=Nn.reduce(function(e,n){if(!n.dueDate)return e;var i=hn(n.dueDate);return!e||i>e?i:e},null),In=xn&&xn>bn()?xn:bn(),Pn=Nn.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,a=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!a}),Mn=!1!==y.showFinalApprovalDueDate,jn=G||(!!Pn||Mn&&!nn),wn=y.wrapperTitle||"Assign Redline and Manage Reminders",Fn=y.wrapperSubTitle||"Sec 4.1 - Technical Security Information",qn=y.wrapperPriority||"High",Cn=y.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.overlay),U.overlay)},{children:n.jsxs("div",e.__assign({style:e.__assign(e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===ze?{width:"1400px",maxWidth:"95vw"}:{}),U.modal)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.header),U.header)},{children:[n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.headerLeft),U.headerLeft)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.modalTitle),U.modalTitle)},{children:wn})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineRow),U.redlineRow)},{children:[n.jsx("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineName),U.redlineName)},{children:Fn})),n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.redlineBadge),Cn),U.redlineBadge)},{children:qn}))]}))]})),n.jsx("button",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.closeBtn),U.closeBtn),onClick:M},{children:n.jsx(i.X,{size:20,color:"#6B7280"})}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabBar),U.tabBar)},{children:Ge.map(function(i){var a=ke===i.tabName;return n.jsxs("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tab),U.tab),a?e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.tabActive),U.tabActive):{}),onClick:function(){return He(i.tabName)}},{children:[i.tabIcon," ",i.tabName]}),i.tabName)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.body),U.body)},{children:["assignees"===ze&&n.jsxs(n.Fragment,{children:[!1!==y.showFinalApprovalDueDate&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateBar),U.dueDateBar)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateLabel),U.dueDateLabel)},{children:["Final Approval due date"," ",n.jsx("sup",e.__assign({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.dueDateInputWrap),U.dueDateInputWrap)},{children:n.jsx(r.default,{value:nn?nn.toISOString().slice(0,10):"",onChange:function(e){var n="function"==typeof e?e(nn):e;n&&hn(n)<In?null==F||F("Final approval due date cannot be before the latest level due date"):cn(n?hn(n):null)},minDate:In,disabled:k.disableDueDates})})),n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.requiredToProceeed),U.requiredToProceeed)},{children:[n.jsx(i.CircleAlert,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),n.jsx(s.AssignReminderLevels,{levels:Xe,totalLevels:B,requireFinalApproval:Ze,setLevels:un,setRequireFinalApproval:function(e){_n(e)},fetchUsers:j,onValidationError:F,customStyles:U,finalApprovalDueDate:nn,displayConfig:k})]}),"reminders"===ze&&n.jsx(l.ManageReminders,e.__assign({data:Tn,schedules:An,setSchedules:yn,remainderOwners:Ln,setRemainderOwners:function(e){var n="function"==typeof e?e(Ln):e;te?te(n):Dn(n)},handelSendNow:function(e,n){oe&&oe(e||An,n||Ln)},showPreviewEmail:null!=de&&de},void 0!==_e&&{labels:_e},void 0!==ce&&{colors:ce},void 0!==ve&&{chipColor:ve},void 0!==fe&&{assignees:fe},void 0!==me&&{fallbackRecipients:me},void 0!==pe&&{recipientsColor:pe},void 0!==ge&&{manualReminderTitle:ge},void 0!==Re&&{manualReminderDescription:Re},void 0!==Se&&{lastReminderText:Se},void 0!==Ee&&{selectRecipientsLabel:Ee},void 0!==De&&{previewEmailButtonLabel:De},void 0!==Ae&&{sendNowButtonLabel:Ae},void 0!==ye&&{reminderSuccessTitle:ye},void 0!==Le&&{reminderSuccessDescription:Le},void 0!==he&&{escalationTitle:he},void 0!==be&&{escalationTitleTooltip:be},void 0!==Te&&{escalationDescription:Te},void 0!==Ne&&{configureAutoReminderText:Ne},void 0!==xe&&{getDynamicStatement:xe},void 0!==Ie&&{reminderStartDateLabel:Ie},void 0!==Pe&&{documentDueDateLabel:Pe},void 0!==Me&&{reminderFrequencyLabel:Me},void 0!==je&&{escalationRemindersLabel:je},void 0!==we&&{escalationTooltip:we},void 0!==Fe&&{escalationConditionText:Fe},void 0!==qe&&{daysText:qe},void 0!==Ce&&{dueDataAndRepeatText:Ce},void 0!==Be&&{reminderFrequencyOptions:Be},void 0!==We&&{escalationFrequencyOptions:We},void 0!==Ue&&{beforeAfterOptions:Ue})),"review"===ze&&n.jsx(t.default,{levels:Xe,reviewData:h,showApproveAndMoveToNextLevelButton:q,onApproveAndMoveToNextLevel:C})]})),!ae&&(!$||!ne)&&n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.footer),U.footer)},{children:[!$&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.clearBtn),U.clearBtn),G?U.actionBtnDisabled:{}),onClick:function(){un(m(_.map(function(n){return e.__assign(e.__assign({},n),{assignees:[],dueDate:null})}))),_n(!1),cn(null)},disabled:G},{children:"Clear"})),!ne&&n.jsx("button",e.__assign({style:e.__assign(e.__assign(e.__assign({},o.DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES.saveBtn),U.saveBtn),jn?e.__assign({opacity:.55,cursor:"not-allowed"},U.actionBtnDisabled):{}),onClick:function(){if(jn)G||null==F||F(function(){if(Mn&&!nn)return"Final approval due date is required";if(!Pn)return"Please fill all required fields before saving";var e=Nn.indexOf(Pn)+1,n=[Pn.dueDate?null:"due date",(Pn.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})?null:"assignee"].filter(Boolean);return"Level ".concat(e," ").concat(n.join(" and ")," ").concat(n.length>1?"are":"is"," required")}());else{var e=p(Xe.filter(function(e){return!e.isHidden}));null==T||T(e),null==x||x(Ze),null==P||P(nn),null==w||w({levels:e,requireFinalApproval:Ze,finalApprovalDueDate:nn,activeTab:ze,schedules:An,remainderOwners:Ln})}},disabled:jn},{children:"Save Changes"}))]}))]}))}))},exports.INITIAL_LEVELS=_;
|
|
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"),n=require("react/jsx-runtime"),r=require("lucide-react"),t=require("react");exports.default=function(i){var s=i.value,o=i.options,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),r=require("lucide-react"),t=require("react");exports.default=function(i){var s=i.value,o=i.options,l=i.onChange,a=i.disabled,u=void 0!==a&&a,c=t.useState(!1),d=c[0],p=c[1],x=t.useRef(null),g=function(e){return(e||"").trim().toLowerCase().replace(/\s*&\s*/g," and ").replace(/\s+/g," ")},f=o.find(function(e){return g(e.label)===g(s)})||o[0];return t.useEffect(function(){function e(e){x.current&&!x.current.contains(e.target)&&p(!1)}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]),n.jsxs("div",e.__assign({ref:x,style:{position:"relative",backgroundColor:"#FFFFFF",borderRadius:"5px"}},{children:[n.jsxs("div",e.__assign({onClick:function(){u||p(!d)},style:{display:"flex",alignItems:"center",gap:"6px",cursor:u?"not-allowed":"pointer",background:"transparent",padding:"2px 4px",userSelect:"none",opacity:u?.65:1}},{children:[f.icon&&n.jsx("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:f.icon})),n.jsx("span",e.__assign({style:{fontSize:"14px"}},{children:f.label})),n.jsx(r.ChevronDown,{size:14,style:{flexShrink:0}})]})),d&&!u&&n.jsx("div",e.__assign({style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"white",border:"1px solid #CBD5E1",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)",zIndex:50,minWidth:"140px",overflow:"hidden"}},{children:o.map(function(r,t){return n.jsxs("div",e.__assign({onClick:function(){l(r.label),p(!1)},style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",cursor:"pointer",fontSize:"14px",backgroundColor:(null==f?void 0:f.label)===r.label?"#F1F5F9":"transparent"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor=(null==f?void 0:f.label)===r.label?"#F1F5F9":"transparent"}},{children:[r.icon&&n.jsx("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:r.icon})),n.jsx("span",{children:r.label})]}),t)})}))]}))};
|
|
2
2
|
//# sourceMappingURL=CustomDropdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("./CustomDropdown.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("./CustomDropdown.js"),r=require("./AddUserPopup.js");exports.default=function(l){var t,a,o,d,u,c=this,p=l.assignees,v=l.onAssigneeChange,g=l.accessLevelOptions,_=l.fetchUsers,x=l.wrapperEl,f=l.levelDetails,b=l.displayConfig,h=void 0===b?{}:b,m=i.useState(""),C=m[0],y=m[1],w=i.useState([]),j=w[0],A=w[1],U=i.useState(null),L=U[0],k=U[1],N=function(e){var n;return e.accessLevel||e.role||""||(null===(n=g[0])||void 0===n?void 0:n.label)||""};return i.useEffect(function(){if(!h.disableAddUser&&C.trim()){var n=setTimeout(function(){return e.__awaiter(c,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,_(C)];case 1:return n=e.sent(),i=new Set(p.map(function(e){return e.id})),A(n.filter(function(e){return!i.has(e.id)})),[3,3];case 2:return s=e.sent(),console.error("[LevelData]: fetchUser error:",s),A([]),[3,3];case 3:return[2]}})})},300);return function(){return clearTimeout(n)}}A([])},[C,p]),n.jsxs("div",e.__assign({style:{borderTop:"1px solid #CBD5E1",padding:"20px"}},{children:[n.jsx("span",e.__assign({style:{fontWeight:600,marginBottom:"8px",fontSize:"14px"}},{children:"Assignee Emails"})),n.jsxs("div",e.__assign({style:{border:"1px solid #CBD5E1",borderRadius:"8px",padding:"8px",marginTop:"10px",display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},{children:[p.map(function(i){var r=!!i.notes&&"string"==typeof i.notes&&!!i.notes.trim();return n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",background:"#E9D5FF",borderRadius:"10px",padding:"2px 8px",fontSize:"12px"}},{children:[n.jsx("span",e.__assign({style:{padding:"4px"}},{children:i.name})),n.jsx(s.default,{value:N(i),options:g,onChange:function(n){return s=i.id,r=n,void(h.disableAccessLevelChange||v(p.map(function(n){return n.id===s?e.__assign(e.__assign({},n),{accessLevel:r,role:r}):n})));var s,r},disabled:h.disableAccessLevelChange}),n.jsx("div",e.__assign({style:{position:"relative",display:"inline-flex",backgroundColor:"white",borderRadius:"3px",padding:1}},{children:n.jsx("button",e.__assign({type:"button",disabled:h.disableNotes,onClick:function(){return function(n){h.disableNotes||k(e.__assign({},n))}(i)},style:{border:"none",background:"transparent",cursor:h.disableNotes?"not-allowed":"pointer",padding:"2px",display:"flex",alignItems:"center",color:r?"#7C3AED":"#C4B5FD",opacity:h.disableNotes?.6:1}},{children:n.jsx("svg",e.__assign({width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M3.03353 3.90755H5.9502M3.03353 5.94922H7.7002M4.59905 9.44922H8.4002C9.38029 9.44922 9.87033 9.44922 10.2447 9.25848C10.574 9.0907 10.8417 8.82299 11.0095 8.4937C11.2002 8.11936 11.2002 7.62931 11.2002 6.64922V3.49922C11.2002 2.51913 11.2002 2.02908 11.0095 1.65474C10.8417 1.32545 10.574 1.05774 10.2447 0.889957C9.87033 0.699219 9.38029 0.699219 8.4002 0.699219H3.5002C2.5201 0.699219 2.03006 0.699219 1.65571 0.889957C1.32643 1.05774 1.05871 1.32545 0.890934 1.65474C0.700195 2.02908 0.700195 2.51913 0.700195 3.49922V10.8116C0.700195 11.1224 0.700195 11.2778 0.763912 11.3577C0.819325 11.4271 0.903352 11.4675 0.992177 11.4674C1.09431 11.4673 1.21567 11.3702 1.45839 11.176L2.8499 10.0628C3.13416 9.83538 3.27629 9.72167 3.43456 9.64082C3.57498 9.56908 3.72444 9.51665 3.8789 9.48495C4.053 9.44922 4.23502 9.44922 4.59905 9.44922Z",stroke:"#98A2B3","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"})}))}))})),n.jsx("button",e.__assign({disabled:h.disableRemoveUser,style:{border:"none",background:"transparent",cursor:h.disableRemoveUser?"not-allowed":"pointer",padding:"2px",display:"flex",alignItems:"center",fontSize:"12px",opacity:h.disableRemoveUser?.45:1},onClick:function(){return e=i.id,void(h.disableRemoveUser||(v(p.filter(function(n){return n.id!==e})),(null==L?void 0:L.id)===e&&k(null)));var e},"aria-label":"Remove ".concat(i.name)},{children:"✕"}))]}),i.id)}),n.jsx("input",{type:"text",value:C,placeholder:"Search users...",onChange:function(e){h.disableAddUser||y(e.target.value)},disabled:h.disableAddUser,style:{border:"none",outline:"none",flex:1,minWidth:"150px",fontSize:"12px",cursor:h.disableAddUser?"not-allowed":"text",opacity:h.disableAddUser?.65:1}})]})),j.length>0&&n.jsx("div",e.__assign({style:{border:"1px solid #CBD5E1",borderRadius:"8px",marginTop:"8px"}},{children:j.map(function(i){return n.jsxs("div",e.__assign({style:{padding:"8px",cursor:h.disableAddUser?"not-allowed":"pointer",opacity:h.disableAddUser?.65:1},onClick:function(){return function(n){var i,s,r,l,t,a,o,d;h.disableAddUser||p.some(function(e){return e.id===n.id})||(v(e.__spreadArray(e.__spreadArray([],p,!0),[e.__assign(e.__assign({},n),{accessLevel:null!==(s=null===(i=g[0])||void 0===i?void 0:i.label)&&void 0!==s?s:"",role:null!==(l=null===(r=g[0])||void 0===r?void 0:r.label)&&void 0!==l?l:"",notes:"",sendMailNow:!1})],!1)),y(""),A([]),k(e.__assign(e.__assign({},n),{accessLevel:null!==(a=null===(t=g[0])||void 0===t?void 0:t.label)&&void 0!==a?a:"",role:null!==(d=null===(o=g[0])||void 0===o?void 0:o.label)&&void 0!==d?d:""})))}(i)}},{children:[i.name,i.email&&n.jsx("span",e.__assign({style:{marginLeft:"8px",color:"#6B7280",fontSize:"11px"}},{children:i.email}))]}),i.id)})})),L&&n.jsx(r.AddUserPopup,{user:L,userLevel:{head:null!==(t=null==f?void 0:f.head)&&void 0!==t?t:"",title:null!==(a=null==f?void 0:f.title)&&void 0!==a?a:""},accessLevel:null!==(u=null!==(o=L.accessLevel)&&void 0!==o?o:null===(d=g[0])||void 0===d?void 0:d.label)&&void 0!==u?u:"",wrapperEl:x,onBackToEditing:function(){L&&(v(p.map(function(n){return n.id===L.id?e.__assign(e.__assign({},n),{notes:"",sendMailNow:!1}):n})),k(null))},onSendLater:function(n){h.disableNotes||L&&(v(p.map(function(i){return i.id===L.id?e.__assign(e.__assign({},i),{notes:n,sendMailNow:!1}):i})),k(null))},onSendNow:function(n){h.disableNotes||L&&(v(p.map(function(i){return i.id===L.id?e.__assign(e.__assign({},i),{notes:n,sendMailNow:!0}):i})),k(null))},disabled:h.disableNotes})]}))};
|
|
2
2
|
//# sourceMappingURL=LevelData.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react"),l=require("../styles/ReviewStatusStyles.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(n),o=function(e){var s=e.trim().split(/\s+/);return 1===s.length?s[0].slice(0,2).toUpperCase():(s[0][0]+s[s.length-1][0]).toUpperCase()},a=function(e){for(var s=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],n=0,i=0;i<e.length;i++)n=e.charCodeAt(i)+((n<<5)-n);return s[Math.abs(n)%s.length]},d=function(e){var s=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof s&&s.trim()?s:"No role assigned"};function p(n){var l,t=n.reviewLevel,r=n.levelIndex,o=n.nextLevel,a=n.showApproveAndMoveToNextLevelButton,d=n.onApproveAndMoveToNextLevel,p=t.level,c=t.assigneeStatuses,u=t.extendedStatus,v=a&&"pending"===u&&!!d,_=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[u])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},f="approved"===u?"1px solid #D1FAE5":"rejected"===u?"1px solid #FCA5A5":"optional"===u?"1px dashed #CBD5E1":"1px solid #E5E7EB",h="approved"===u?"#F0FDF4":"rejected"===u?"#FEF2F2":"#F8FAFC";return!p.assignees||!Array.isArray(p.assignees)||p.assignees.length<1?null:s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:f,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:h,borderBottom:f,padding:"12px 16px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:10}},{children:[s.jsx(x,{name:p.headerName}),s.jsx("span",e.__assign({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:p.title}))]})),s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[v&&s.jsxs("button",e.__assign({type:"button",onClick:function(){return null==d?void 0:d({level:p,levelIndex:r,nextLevel:o})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx(i.Check,{size:13}),"Approve & Move to Next Level"]})),s.jsxs("div",e.__assign({style:{backgroundColor:_.bg,color:_.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[_.icon,_.text]}))]}))]})),s.jsx("div",e.__assign({style:{padding:"16px"}},{children:c.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:16}},{children:c.map(function(e,n){var i;return s.jsx(g,{assigneeStatus:e,extendedStatus:u},null!==(i=e.user.id)&&void 0!==i?i:n)})})):s.jsx("div",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function c(n){var l,t,r,p,c=n.reviewLevel,g=c.assigneeStatuses,x=c.extendedStatus,u=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[x])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},v=null===(t=g[0])||void 0===t?void 0:t.user;null==v||v.email;var _=d(v);return s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[v?s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:a(null!==(r=v.id)&&void 0!==r?r:v.name).bg,color:a(null!==(p=v.id)&&void 0!==p?p:v.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:o(v.name)})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:v.name})),s.jsxs("span",e.__assign({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",_]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):s.jsx("span",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),s.jsxs("div",e.__assign({style:{backgroundColor:u.bg,color:u.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[u.icon,u.text]}))]}))}function g(n){var l,t=n.assigneeStatus,r=n.extendedStatus,p=t.user,c=t.approved||"approved"===p.action,g=t.rejected||"rejected"===p.action,x=o(p.name),u=a(null!==(l=p.id)&&void 0!==l?l:p.name),v=d(p);return s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:u.bg,color:u.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:x})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:p.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:v}))]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:p.email}))]}))]})),s.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:c?s.jsx(i.CircleCheck,{size:20,color:"#16A34A",strokeWidth:1.5}):g?s.jsx(i.X,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===r?s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{fontSize:"13px",color:"#4B5563"}}),s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):"optional"===r?s.jsx(i.MinusCircle,{size:20,color:"#CBD5E1",strokeWidth:1.5}):s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function x(n){var i=n.name,l=a(i);return s.jsx("span",e.__assign({style:{backgroundColor:l.bg,color:l.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:i}))}var u=function(e){switch(e){case 0:return s.jsx(i.LucidePen,{size:16,color:"#475569"});case 1:return s.jsx(i.FileCheck,{size:16,color:"#475569"});case 2:return s.jsx(i.User,{size:16,color:"#475569"});default:return s.jsx(i.CheckCircle,{size:16,color:"#475569"})}};function v(n){var t=n.levels.filter(function(e){var s,n;return(null!==(n=null===(s=e.assignees)||void 0===s?void 0:s.length)&&void 0!==n?n:0)>0});return s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowBox},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowTitle},{children:"Current Approval Flow"})),t.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:t.map(function(n,o){var a,p=n.isHidden,c=!n.isMandatory&&!p,g=p?s.jsx(i.User,{size:16,color:"#475569"}):u(o);return s.jsxs(r.default.Fragment,{children:[s.jsxs("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:c?"1px dashed #CBD5E1":void 0})},{children:[g,s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[n.assignees.map(function(n,i){var l,t,o=d(n);return s.jsxs(r.default.Fragment,{children:[i>0&&s.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:13,color:c?"#64748B":"#374151"}},{children:n.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:o}))]}))]},null!==(t=null!==(l=n.id)&&void 0!==l?l:n.email)&&void 0!==t?t:i)}),c&&s.jsx("span",e.__assign({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),o<t.length-1&&s.jsx(i.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(a=n.id)&&void 0!==a?a:"".concat(n.headerName,"-").concat(o))})})):s.jsx("p",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowEmpty},{children:"No owners assigned yet."}))]}))}exports.default=function(n){var t=n.levels,o=n.reviewData,a=void 0===o?{}:o,d=n.showApproveAndMoveToNextLevelButton,g=void 0!==d&&d,x=n.onApproveAndMoveToNextLevel,u=t.map(function(e,s){var n,i,l,t=null!==(i=null!==(n=a[s])&&void 0!==n?n:a[e.headerName])&&void 0!==i?i:{},r=(null!==(l=e.assignees)&&void 0!==l?l:[]).map(function(e){return{user:e,approved:!0===t[String(e.id)]||!0===t[String(e.email)]||"approved"===e.action||!0===e.approved,rejected:"rejected"===t[String(e.id)]||"rejected"===t[String(e.email)]||"rejected"===e.action}}),o="not_started";if(!0===e.isApproved)o="approved";else if(!0===e.isRejected)o="rejected";else if("approved"===e.status||"completed"===e.status)o="approved";else if("rejected"===e.status)o="rejected";else{var d=r.length>0&&r.every(function(e){return e.approved}),p=r.some(function(e){return e.rejected});d?o="approved":p&&(o="rejected")}return{level:e,assigneeStatuses:r,status:o}}),_=!1,f=u.map(function(s){var n="waiting",i=!0===s.level.isHidden;return"approved"===s.status?n="approved":"rejected"===s.status?(n="rejected",_=!0):s.level.isMandatory||i?_||(n="pending",_=!0):n="optional",e.__assign(e.__assign({},s),{extendedStatus:n,isFinalApproval:i})}),h=function(e){return e.filter(function(e){return"approved"===e.status}).length}(u),j=u.length;return s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:24}},{children:[s.jsxs("div",{children:[s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressHeader},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressTitle},{children:"Approval Progress"})),s.jsxs("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressCount},{children:[h," of ",j," level",1!==j?"s":""," complete"]}))]})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressBarTrack},{children:f.map(function(n,i){var t,r="approved"===n.extendedStatus,o="rejected"===n.extendedStatus,a="optional"===n.extendedStatus,d=0===i,p=i===j-1;return!(null===(t=n.level)||void 0===t?void 0:t.assignees)||!Array.isArray(n.level.assignees)||n.level.assignees.length<1?null:s.jsx("div",{style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressSegment),{backgroundColor:r?"#6366F1":o?"#EF4444":a?"#F1F5F9":"#E5E7EB",borderRadius:d&&p?"999px":d?"999px 0 0 999px":p?"0 999px 999px 0":"0",marginRight:p?0:3})},i)})})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressLabels},{children:f.map(function(n,i){return s.jsx("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressLabel),{color:"approved"===n.extendedStatus?"#6366F1":"rejected"===n.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===n.extendedStatus||"rejected"===n.extendedStatus?600:400})},{children:n.level.assignees&&n.level.assignees.length>0?"".concat(n.level.headerName," - ").concat(n.level.title):""}),i)})}))]}),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:0}},{children:[s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionHeadingRow},{children:s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:6}},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionTitle},{children:"Approval Levels"})),s.jsx(i.Info,{size:15,color:"#9CA3AF"})]}))})),s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:f.map(function(n,i){var l,t,o=i===f.length-1,a=n.isFinalApproval,d=f[i+1],u=null==d?void 0:d.isFinalApproval,v=d&&!d.level.isMandatory&&!u;return a?s.jsxs(r.default.Fragment,{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),s.jsx("div",e.__assign({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),s.jsx(c,{reviewLevel:n})]},i):s.jsxs(r.default.Fragment,{children:[s.jsx(p,{reviewLevel:n,levelIndex:i,nextLevel:null!==(l=null==d?void 0:d.level)&&void 0!==l?l:null,showApproveAndMoveToNextLevelButton:g,onApproveAndMoveToNextLevel:x}),!o&&!u&&d.level.assignees&&(null===(t=d.level.assignees)||void 0===t?void 0:t.length)>0&&s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:v?"optional":"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},i)})}))]})),s.jsx(v,{levels:t})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react"),l=require("../styles/ReviewStatusStyles.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(n),r=function(e){var s=e.trim().split(/\s+/);return 1===s.length?s[0].slice(0,2).toUpperCase():(s[0][0]+s[s.length-1][0]).toUpperCase()},a=function(e){for(var s=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],n=0,i=0;i<e.length;i++)n=e.charCodeAt(i)+((n<<5)-n);return s[Math.abs(n)%s.length]},d=function(e){var s=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof s&&s.trim()?s:"No role assigned"},p=function(e){return!0===e||("string"==typeof e?["approved","completed","complete","done","accepted"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(p(e.approved)||p(e.status)||p(e.action)||p(e.value)))},c=function(e){return"string"==typeof e?["rejected","declined","denied"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(c(e.rejected)||c(e.status)||c(e.action)||c(e.value))};function g(n){var l,t=n.reviewLevel,o=n.levelIndex,r=n.nextLevel,a=n.showApproveAndMoveToNextLevelButton,d=n.onApproveAndMoveToNextLevel,p=t.level,c=t.assigneeStatuses,g=t.extendedStatus,x=a&&"pending"===g&&!!d,_=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[g])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},f="approved"===g?"1px solid #D1FAE5":"rejected"===g?"1px solid #FCA5A5":"optional"===g?"1px dashed #CBD5E1":"1px solid #E5E7EB",h="approved"===g?"#F0FDF4":"rejected"===g?"#FEF2F2":"#F8FAFC";return!p.assignees||!Array.isArray(p.assignees)||p.assignees.length<1?null:s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:f,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:h,borderBottom:f,padding:"12px 16px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:10}},{children:[s.jsx(v,{name:p.headerName}),s.jsx("span",e.__assign({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:p.title}))]})),s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[x&&s.jsxs("button",e.__assign({type:"button",onClick:function(){return null==d?void 0:d({level:p,levelIndex:o,nextLevel:r})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx(i.Check,{size:13}),"Approve & Move to Next Level"]})),s.jsxs("div",e.__assign({style:{backgroundColor:_.bg,color:_.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[_.icon,_.text]}))]}))]})),s.jsx("div",e.__assign({style:{padding:"16px"}},{children:c.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:16}},{children:c.map(function(e,n){var i;return s.jsx(u,{assigneeStatus:e,extendedStatus:g},null!==(i=e.user.id)&&void 0!==i?i:n)})})):s.jsx("div",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function x(n){var l,t,o,p,c=n.reviewLevel,g=c.assigneeStatuses,x=c.extendedStatus,u=null!==(l={approved:{bg:"#ECFDF5",color:"#059669",icon:s.jsx(i.Check,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:s.jsx(i.Hourglass,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:s.jsx(i.X,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:s.jsx(i.Info,{size:14}),text:"Optional"}}[x])&&void 0!==l?l:{bg:"#F3F4F6",color:"#4B5563",icon:s.jsx(i.Hourglass,{size:14}),text:"Waiting"},v=null===(t=g[0])||void 0===t?void 0:t.user;null==v||v.email;var _=d(v);return s.jsxs("div",e.__assign({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[v?s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:a(null!==(o=v.id)&&void 0!==o?o:v.name).bg,color:a(null!==(p=v.id)&&void 0!==p?p:v.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:r(v.name)})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:v.name})),s.jsxs("span",e.__assign({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",_]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):s.jsx("span",e.__assign({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),s.jsxs("div",e.__assign({style:{backgroundColor:u.bg,color:u.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[u.icon,u.text]}))]}))}function u(n){var l,t=n.assigneeStatus,o=n.extendedStatus,p=t.user,c=t.approved||"approved"===p.action,g=t.rejected||"rejected"===p.action,x=r(p.name),u=a(null!==(l=p.id)&&void 0!==l?l:p.name),v=d(p);return s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[s.jsx("div",e.__assign({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:u.bg,color:u.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:x})),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[s.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:p.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:v}))]})),s.jsx("span",e.__assign({style:{fontSize:"13px",color:"#6B7280"}},{children:p.email}))]}))]})),s.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:c?s.jsx(i.CircleCheck,{size:20,color:"#16A34A",strokeWidth:1.5}):g?s.jsx(i.X,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===o?s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{fontSize:"13px",color:"#4B5563"}}),s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):"optional"===o?s.jsx(i.MinusCircle,{size:20,color:"#CBD5E1",strokeWidth:1.5}):s.jsx(i.MinusCircle,{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function v(n){var i=n.name,l=a(i);return s.jsx("span",e.__assign({style:{backgroundColor:l.bg,color:l.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:i}))}var _=function(e){switch(e){case 0:return s.jsx(i.LucidePen,{size:16,color:"#475569"});case 1:return s.jsx(i.FileCheck,{size:16,color:"#475569"});case 2:return s.jsx(i.User,{size:16,color:"#475569"});default:return s.jsx(i.CheckCircle,{size:16,color:"#475569"})}};function f(n){var t=n.levels.filter(function(e){var s,n;return(null!==(n=null===(s=e.assignees)||void 0===s?void 0:s.length)&&void 0!==n?n:0)>0});return s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowBox},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowTitle},{children:"Current Approval Flow"})),t.length>0?s.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:t.map(function(n,r){var a,p=n.isHidden,c=!n.isMandatory&&!p,g=p?s.jsx(i.User,{size:16,color:"#475569"}):_(r);return s.jsxs(o.default.Fragment,{children:[s.jsxs("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:c?"1px dashed #CBD5E1":void 0})},{children:[g,s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[n.assignees.map(function(n,i){var l,t,r=d(n);return s.jsxs(o.default.Fragment,{children:[i>0&&s.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),s.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[s.jsx("span",e.__assign({style:{fontSize:13,color:c?"#64748B":"#374151"}},{children:n.name})),s.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:r}))]}))]},null!==(t=null!==(l=n.id)&&void 0!==l?l:n.email)&&void 0!==t?t:i)}),c&&s.jsx("span",e.__assign({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<t.length-1&&s.jsx(i.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(a=n.id)&&void 0!==a?a:"".concat(n.headerName,"-").concat(r))})})):s.jsx("p",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.flowEmpty},{children:"No owners assigned yet."}))]}))}exports.default=function(n){var t=n.levels,r=n.reviewData,a=void 0===r?{}:r,d=n.showApproveAndMoveToNextLevelButton,u=void 0!==d&&d,v=n.onApproveAndMoveToNextLevel,_=t.map(function(e,s){var n,i,l,t,o,r,d,g,x=null!==(d=null!==(l=null!==(i=null!==(n=a[s])&&void 0!==n?n:a[e.headerName])&&void 0!==i?i:a[e.title])&&void 0!==l?l:e.isHidden?null!==(r=null!==(o=null!==(t=a.final)&&void 0!==t?t:a.Final)&&void 0!==o?o:a.finalApproval)&&void 0!==r?r:a.final_approval:void 0)&&void 0!==d?d:{},u=x&&"object"==typeof x?x:{},v=(null!==(g=e.assignees)&&void 0!==g?g:[]).map(function(s){var n,i,l,t,o,r,a=null!==(i=null!==(n=u[String(s.id)])&&void 0!==n?n:u[String(s.email)])&&void 0!==i?i:e.isHidden?null!==(r=null!==(o=null!==(t=null!==(l=u.owner)&&void 0!==l?l:u.final)&&void 0!==t?t:u.finalApproval)&&void 0!==o?o:u.final_approval)&&void 0!==r?r:x:void 0;return{user:s,approved:p(a)||p(s.action)||p(s.status)||p(s.approved)||p(s.isApproved),rejected:c(a)||c(s.action)||c(s.status)||c(s.rejected)||c(s.isRejected)}}),_="not_started";if(p(x)||p(e.isApproved)||p(e.approved))_="approved";else if(c(x)||c(e.isRejected)||c(e.rejected))_="rejected";else if(p(e.status))_="approved";else if(c(e.status))_="rejected";else{var f=v.length>0&&v.every(function(e){return e.approved}),h=v.some(function(e){return e.rejected});f?_="approved":h&&(_="rejected")}return{level:e,assigneeStatuses:v,status:_}}),h=!1,j=_.map(function(s){var n="waiting",i=!0===s.level.isHidden;return"approved"===s.status?n="approved":"rejected"===s.status?(n="rejected",h=!0):s.level.isMandatory||i?h||(n="pending",h=!0):n="optional",e.__assign(e.__assign({},s),{extendedStatus:n,isFinalApproval:i})}),F=function(e){return e.filter(function(e){return"approved"===e.status}).length}(_),y=_.length;return s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:24}},{children:[s.jsxs("div",{children:[s.jsxs("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressHeader},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressTitle},{children:"Approval Progress"})),s.jsxs("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressCount},{children:[F," of ",y," level",1!==y?"s":""," complete"]}))]})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressBarTrack},{children:j.map(function(n,i){var t,o="approved"===n.extendedStatus,r="rejected"===n.extendedStatus,a="optional"===n.extendedStatus,d=0===i,p=i===y-1;return!(null===(t=n.level)||void 0===t?void 0:t.assignees)||!Array.isArray(n.level.assignees)||n.level.assignees.length<1?null:s.jsx("div",{style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressSegment),{backgroundColor:o?"#6366F1":r?"#EF4444":a?"#F1F5F9":"#E5E7EB",borderRadius:d&&p?"999px":d?"999px 0 0 999px":p?"0 999px 999px 0":"0",marginRight:p?0:3})},i)})})),s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.progressLabels},{children:j.map(function(n,i){return s.jsx("span",e.__assign({style:e.__assign(e.__assign({},l.DEFAULT_REVIEW_STATUS_STYLES.progressLabel),{color:"approved"===n.extendedStatus?"#6366F1":"rejected"===n.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===n.extendedStatus||"rejected"===n.extendedStatus?600:400})},{children:n.level.assignees&&n.level.assignees.length>0?"".concat(n.level.headerName," - ").concat(n.level.title):""}),i)})}))]}),s.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:0}},{children:[s.jsx("div",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionHeadingRow},{children:s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:6}},{children:[s.jsx("span",e.__assign({style:l.DEFAULT_REVIEW_STATUS_STYLES.sectionTitle},{children:"Approval Levels"})),s.jsx(i.Info,{size:15,color:"#9CA3AF"})]}))})),s.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:j.map(function(n,i){var l,t,r=i===j.length-1,a=n.isFinalApproval,d=j[i+1],p=null==d?void 0:d.isFinalApproval,c=d&&!d.level.isMandatory&&!p;return a?s.jsxs(o.default.Fragment,{children:[s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),s.jsx("div",e.__assign({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),s.jsx(x,{reviewLevel:n})]},i):s.jsxs(o.default.Fragment,{children:[s.jsx(g,{reviewLevel:n,levelIndex:i,nextLevel:null!==(l=null==d?void 0:d.level)&&void 0!==l?l:null,showApproveAndMoveToNextLevelButton:u,onApproveAndMoveToNextLevel:v}),!r&&!p&&d.level.assignees&&(null===(t=d.level.assignees)||void 0===t?void 0:t.length)>0&&s.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),s.jsx("span",e.__assign({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:c?"optional":"then"})),s.jsx("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},i)})}))]})),s.jsx(f,{levels:t})]}))};
|
|
2
2
|
//# sourceMappingURL=ReviewStatus.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as r,Fragment as t}from"react/jsx-runtime";import{Bell as a,ClipboardList as o,X as l,CircleAlert as s}from"lucide-react";import d,{useState as u,useEffect as c}from"react";import{AssignReminderLevels as v}from"./AssignReminderLevels.js";import m from"./components/ReviewStatus.js";import p from"./components/CustomDatePicker.js";import{ManageReminders as f}from"./ManageReminders.js";import{DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES as y}from"./styles/AssignReminderWrapperStyles.js";var h=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],b=[{tabName:"Assignees & Approvers",tabIcon:i("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[r("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),r("circle",{cx:"9",cy:"7",r:"4"}),r("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),r("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:r(a,{size:15})},{tabName:"Review Status",tabIcon:r(o,{size:15})}],D=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function g(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}function A(a){var o,A,w=a.metadata,_=void 0===w?{}:w,L=a.reviewData,R=void 0===L?{}:L,T=a.levels,S=a.setLevels,C=a.requireFinalApproval,q=a.setRequireFinalApproval,B=a.approvalDueDate,N=a.setApprovalDueDate,F=a.onClose,x=a.fetchUsers,M=a.onSave,O=a.onValidationError,k=a.showApproveAndMoveToNextLevelButton,H=a.onApproveAndMoveToNextLevel,I=a.totalLevels,j=a.customStyles,P=void 0===j?{}:j,E=a.isSaving,W=void 0!==E&&E,z=a.displayConfig,U=void 0===z?{}:z,V=a.onRequireFinalApproval,Y=a.isOwner,G=void 0===Y||Y,J=a.blockEditScreen,K=void 0!==J&&J,Q=a.hideManageReminders,X=void 0!==Q&&Q,Z=a.hideClearButton,$=void 0!==Z&&Z,ee=a.hideSaveChangesButton,ne=void 0!==ee&&ee,ie=a.hideFooterActions,re=void 0!==ie&&ie;a.hideAssigneeApproverScreen,a.remindersData;var te=a.remainderOwners,ae=a.setRemainderOwners,oe=a.schedules,le=a.setSchedules,se=a.handelSendNow,de=a.showPreviewEmail,ue=a.tabName,ce=a.reminderLabels,ve=a.reminderColors,me=a.reminderChipColor,pe=a.reminderAssignees,fe=a.reminderFallbackRecipients,ye=a.reminderRecipientsColor,he=a.manualReminderTitle,be=a.manualReminderDescription,De=a.lastReminderText,ge=a.selectRecipientsLabel,Ae=a.previewEmailButtonLabel,we=a.sendNowButtonLabel,_e=a.reminderSuccessTitle,Le=a.reminderSuccessDescription,Re=a.escalationTitle,Te=a.escalationTitleTooltip,Se=a.escalationDescription,Ce=a.configureAutoReminderText,qe=a.getDynamicStatement,Be=a.reminderStartDateLabel,Ne=a.documentDueDateLabel,Fe=a.reminderFrequencyLabel,xe=a.escalationRemindersLabel,Me=a.escalationTooltip,Oe=a.escalationConditionText,ke=a.daysText,He=a.dueDataAndRepeatText,Ie=a.reminderFrequencyOptions,je=a.escalationFrequencyOptions,Pe=a.beforeAfterOptions,Ee=d.useMemo(function(){var e;return(null===(e=_.tabData)||void 0===e?void 0:e.length)?_.tabData:b},[_.tabData]),We=d.useMemo(function(){return Ee.filter(function(e){var n=g(e.tabName);return!((!G||K)&&"assignees"===n)&&(!X||"reminders"!==n)})},[Ee,G,K,X]),ze=u(null!==(A=null===(o=We[0])||void 0===o?void 0:o.tabName)&&void 0!==A?A:""),Ue=ze[0],Ve=ze[1],Ye=g(Ue),Ge=u(T||h),Je=Ge[0],Ke=Ge[1],Qe=u(C||!1),Xe=Qe[0],Ze=Qe[1],$e=u(B||null),en=$e[0],nn=$e[1],rn=u(null),tn=rn[0],an=rn[1],on=u([]),ln=on[0],sn=on[1],dn=u(te||D),un=dn[0],cn=dn[1],vn=void 0!==oe?oe:ln,mn=void 0!==le?le:sn,pn=void 0!==te?te:un,fn=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e(e({},n),{isMandatory:!0,hasDueDate:!0})})},yn=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},hn=function(){return yn(new Date)},bn=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})})})})},Dn=d.useMemo(function(){return{due_at:en?en.toISOString():"",assignee:Je.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,r){var t;return e(e({},n),((t={})[r]=i,t))},{})}},[en,Je]);c(function(){void 0!==te&&cn(te)},[te]),c(function(){V&&V().then(function(e){Array.isArray(e)&&e.length>0?an(e[0]):e&&!Array.isArray(e)&&an(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),c(function(){ue&&We.some(function(e){return e.tabName===ue})&&Ve(ue)},[ue,We]),c(function(){var e,n;We.some(function(e){return e.tabName===Ue})||Ve(null!==(n=null===(e=We[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[We,Ue]),c(function(){T&&Ke(function(e){var i=e.find(function(e){return e.isHidden}),r=i?n(n([],T,!0),[i],!1):T;return bn(fn(r))})},[T]),c(function(){void 0!==C&&Ze(C)},[C]),c(function(){void 0!==B&&nn(B)},[B]),c(function(){Ke(function(e){var i=e.filter(function(e){return!e.isHidden});if(Xe){var r={headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[{id:(null==tn?void 0:tn.id)||"me",email:(null==tn?void 0:tn.email)||"",name:(null==tn?void 0:tn.name)?"".concat(tn.name," (You)"):"Username (You)",accessLevel:"Approve",role:"Final Approver"}]};return bn(n(n([],i,!0),[r],!1))}return bn(i)})},[Xe,tn]),c(function(){var e=Je.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});cn(function(n){var i=n.length===e.length&&e.every(function(e,i){var r;return(null===(r=n[i])||void 0===r?void 0:r.email)===e.email});return i?n:e.map(function(e,i){var r=n.find(function(n){return n.email===e.email});return r||{id:i+1,name:e.name,email:e.email,reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}})})},[Je]);var gn=Je.filter(function(e){return!e.isHidden}),An=gn.reduce(function(e,n){if(!n.dueDate)return e;var i=yn(n.dueDate);return!e||i>e?i:e},null),wn=An&&An>hn()?An:hn(),_n=gn.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,r=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!r}),Ln=!1!==_.showFinalApprovalDueDate,Rn=W||(!!_n||Ln&&!en),Tn=_.wrapperTitle||"Assign Redline and Manage Reminders",Sn=_.wrapperSubTitle||"Sec 4.1 - Technical Security Information",Cn=_.wrapperPriority||"High",qn=_.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return r("div",e({style:e(e({},y.overlay),P.overlay)},{children:i("div",e({style:e(e(e(e({},y.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===Ye?{width:"1400px",maxWidth:"95vw"}:{}),P.modal)},{children:[i("div",e({style:e(e({},y.header),P.header)},{children:[i("div",e({style:e(e({},y.headerLeft),P.headerLeft)},{children:[r("span",e({style:e(e({},y.modalTitle),P.modalTitle)},{children:Tn})),i("div",e({style:e(e({},y.redlineRow),P.redlineRow)},{children:[r("span",e({style:e(e({},y.redlineName),P.redlineName)},{children:Sn})),r("span",e({style:e(e(e({},y.redlineBadge),qn),P.redlineBadge)},{children:Cn}))]}))]})),r("button",e({style:e(e({},y.closeBtn),P.closeBtn),onClick:F},{children:r(l,{size:20,color:"#6B7280"})}))]})),r("div",e({style:e(e({},y.tabBar),P.tabBar)},{children:We.map(function(n){var r=Ue===n.tabName;return i("button",e({style:e(e(e({},y.tab),P.tab),r?e(e({},y.tabActive),P.tabActive):{}),onClick:function(){return Ve(n.tabName)}},{children:[n.tabIcon," ",n.tabName]}),n.tabName)})})),i("div",e({style:e(e({},y.body),P.body)},{children:["assignees"===Ye&&i(t,{children:[!1!==_.showFinalApprovalDueDate&&i("div",e({style:e(e({},y.dueDateBar),P.dueDateBar)},{children:[i("span",e({style:e(e({},y.dueDateLabel),P.dueDateLabel)},{children:["Final Approval due date"," ",r("sup",e({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),r("div",e({style:e(e({},y.dueDateInputWrap),P.dueDateInputWrap)},{children:r(p,{value:en?en.toISOString().slice(0,10):"",onChange:function(e){var n="function"==typeof e?e(en):e;n&&yn(n)<wn?null==O||O("Final approval due date cannot be before the latest level due date"):nn(n?yn(n):null)},minDate:wn,disabled:U.disableDueDates})})),i("span",e({style:e(e({},y.requiredToProceeed),P.requiredToProceeed)},{children:[r(s,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),r(v,{levels:Je,totalLevels:I,requireFinalApproval:Xe,setLevels:Ke,setRequireFinalApproval:function(e){Ze(e)},fetchUsers:x,onValidationError:O,customStyles:P,finalApprovalDueDate:en,displayConfig:U})]}),"reminders"===Ye&&r(f,e({data:Dn,schedules:vn,setSchedules:mn,remainderOwners:pn,setRemainderOwners:function(e){var n="function"==typeof e?e(pn):e;ae?ae(n):cn(n)},handelSendNow:function(e,n){se&&se(e||vn,n||pn)},showPreviewEmail:null!=de&&de},void 0!==ce&&{labels:ce},void 0!==ve&&{colors:ve},void 0!==me&&{chipColor:me},void 0!==pe&&{assignees:pe},void 0!==fe&&{fallbackRecipients:fe},void 0!==ye&&{recipientsColor:ye},void 0!==he&&{manualReminderTitle:he},void 0!==be&&{manualReminderDescription:be},void 0!==De&&{lastReminderText:De},void 0!==ge&&{selectRecipientsLabel:ge},void 0!==Ae&&{previewEmailButtonLabel:Ae},void 0!==we&&{sendNowButtonLabel:we},void 0!==_e&&{reminderSuccessTitle:_e},void 0!==Le&&{reminderSuccessDescription:Le},void 0!==Re&&{escalationTitle:Re},void 0!==Te&&{escalationTitleTooltip:Te},void 0!==Se&&{escalationDescription:Se},void 0!==Ce&&{configureAutoReminderText:Ce},void 0!==qe&&{getDynamicStatement:qe},void 0!==Be&&{reminderStartDateLabel:Be},void 0!==Ne&&{documentDueDateLabel:Ne},void 0!==Fe&&{reminderFrequencyLabel:Fe},void 0!==xe&&{escalationRemindersLabel:xe},void 0!==Me&&{escalationTooltip:Me},void 0!==Oe&&{escalationConditionText:Oe},void 0!==ke&&{daysText:ke},void 0!==He&&{dueDataAndRepeatText:He},void 0!==Ie&&{reminderFrequencyOptions:Ie},void 0!==je&&{escalationFrequencyOptions:je},void 0!==Pe&&{beforeAfterOptions:Pe})),"review"===Ye&&r(m,{levels:Je,reviewData:R,showApproveAndMoveToNextLevelButton:k,onApproveAndMoveToNextLevel:H})]})),!re&&(!$||!ne)&&i("div",e({style:e(e({},y.footer),P.footer)},{children:[!$&&r("button",e({style:e(e(e({},y.clearBtn),P.clearBtn),W?P.actionBtnDisabled:{}),onClick:function(){Ke(fn(h.map(function(n){return e(e({},n),{assignees:[],dueDate:null})}))),Ze(!1),nn(null)},disabled:W},{children:"Clear"})),!ne&&r("button",e({style:e(e(e({},y.saveBtn),P.saveBtn),Rn?e({opacity:.55,cursor:"not-allowed"},P.actionBtnDisabled):{}),onClick:function(){if(Rn)W||null==O||O(function(){if(Ln&&!en)return"Final approval due date is required";if(!_n)return"Please fill all required fields before saving";var e=gn.indexOf(_n)+1,n=[_n.dueDate?null:"due date",(_n.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=bn(Je.filter(function(e){return!e.isHidden}));null==S||S(e),null==q||q(Xe),null==N||N(en),null==M||M({levels:e,requireFinalApproval:Xe,finalApprovalDueDate:en,activeTab:Ye,schedules:vn,remainderOwners:pn})}},disabled:Rn},{children:"Save Changes"}))]}))]}))}))}export{A as AssignReminderWrapper,h as INITIAL_LEVELS};
|
|
1
|
+
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsxs as i,jsx as r,Fragment as t}from"react/jsx-runtime";import{Bell as a,ClipboardList as o,X as l,CircleAlert as s}from"lucide-react";import d,{useState as u,useEffect as c}from"react";import{AssignReminderLevels as v}from"./AssignReminderLevels.js";import m from"./components/ReviewStatus.js";import p from"./components/CustomDatePicker.js";import{ManageReminders as f}from"./ManageReminders.js";import{DEFAULT_ASSIGN_REMINDER_WRAPPER_STYLES as y}from"./styles/AssignReminderWrapperStyles.js";var h=[{headerName:"L1",title:"First Level",isMandatory:!0,hasDueDate:!0,dueDate:null,assignees:[]},{headerName:"L2",title:"Second Level",isMandatory:!1,hasDueDate:!0,dueDate:null,assignees:[]}],b=[{tabName:"Assignees & Approvers",tabIcon:i("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[r("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),r("circle",{cx:"9",cy:"7",r:"4"}),r("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),r("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}))},{tabName:"Manage Reminders",tabIcon:r(a,{size:15})},{tabName:"Review Status",tabIcon:r(o,{size:15})}],D=[{id:1,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:2,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}},{id:3,name:"",email:"",reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}];function g(e){var n=e.toLowerCase();return n.includes("reminder")?"reminders":n.includes("review")?"review":"assignees"}var w=function(n){return n.map(function(n,i){return 0!==i||n.isHidden?n:e(e({},n),{isMandatory:!0,hasDueDate:!0})})},A=function(n){return n.map(function(n){var i;return e(e({},n),{assignees:(null!==(i=n.assignees)&&void 0!==i?i:[]).map(function(n){var i=n.accessLevel||n.role||"";return e(e({},n),{role:i,accessLevel:i})})})})},_=function(e,i){void 0===e&&(e=h),void 0===i&&(i=[]);var r=e.find(function(e){return e.isHidden}),t=i.find(function(e){return e.isHidden}),a=e.filter(function(e){return!e.isHidden}),o=r||t,l=o?n(n([],a,!0),[o],!1):a;return A(w(l))},L=function(e){if(!e)return"";var n=e instanceof Date?e:new Date(e),i=n.getTime();return Number.isFinite(i)?n.toISOString():""},R=function(e){return void 0===e&&(e=[]),JSON.stringify(e.map(function(e){var n,i,r,t;return{headerName:null!==(n=e.headerName)&&void 0!==n?n:"",title:null!==(i=e.title)&&void 0!==i?i:"",isMandatory:!!e.isMandatory,hasDueDate:!!e.hasDueDate,isHidden:!!e.isHidden,dueDate:L(e.dueDate),status:null!==(r=e.status)&&void 0!==r?r:"",isApproved:!!e.isApproved,isRejected:!!e.isRejected,assignees:(null!==(t=e.assignees)&&void 0!==t?t:[]).map(function(e){var n,i,r,t,a,o,l,s,d,u;return{id:null!==(n=e.id)&&void 0!==n?n:"",name:null!==(i=e.name)&&void 0!==i?i:"",email:null!==(r=e.email)&&void 0!==r?r:"",accessLevel:null!==(a=null!==(t=e.accessLevel)&&void 0!==t?t:e.role)&&void 0!==a?a:"",role:null!==(l=null!==(o=e.role)&&void 0!==o?o:e.accessLevel)&&void 0!==l?l:"",notes:null!==(s=e.notes)&&void 0!==s?s:"",sendMailNow:!!e.sendMailNow,action:null!==(d=e.action)&&void 0!==d?d:"",action_taken_at:null!==(u=e.action_taken_at)&&void 0!==u?u:""}})}}))},S=function(e){return L(e)};function T(a){var o,L,T=a.metadata,N=void 0===T?{}:T,C=a.reviewData,q=void 0===C?{}:C,B=a.levels,M=a.setLevels,F=a.requireFinalApproval,x=a.setRequireFinalApproval,O=a.approvalDueDate,k=a.setApprovalDueDate,H=a.onClose,j=a.fetchUsers,I=a.onSave,P=a.onValidationError,E=a.showApproveAndMoveToNextLevelButton,W=a.onApproveAndMoveToNextLevel,z=a.totalLevels,U=a.customStyles,V=void 0===U?{}:U,Y=a.isSaving,J=void 0!==Y&&Y,G=a.displayConfig,K=void 0===G?{}:G,Q=a.onRequireFinalApproval,X=a.isOwner,Z=void 0===X||X,$=a.blockEditScreen,ee=void 0!==$&&$,ne=a.hideManageReminders,ie=void 0!==ne&&ne,re=a.hideClearButton,te=void 0!==re&&re,ae=a.hideSaveChangesButton,oe=void 0!==ae&&ae,le=a.hideFooterActions,se=void 0!==le&≤a.hideAssigneeApproverScreen,a.remindersData;var de=a.remainderOwners,ue=a.setRemainderOwners,ce=a.schedules,ve=a.setSchedules,me=a.handelSendNow,pe=a.showPreviewEmail,fe=a.tabName,ye=a.reminderLabels,he=a.reminderColors,be=a.reminderChipColor,De=a.reminderAssignees,ge=a.reminderFallbackRecipients,we=a.reminderRecipientsColor,Ae=a.manualReminderTitle,_e=a.manualReminderDescription,Le=a.lastReminderText,Re=a.selectRecipientsLabel,Se=a.previewEmailButtonLabel,Te=a.sendNowButtonLabel,Ne=a.reminderSuccessTitle,Ce=a.reminderSuccessDescription,qe=a.escalationTitle,Be=a.escalationTitleTooltip,Me=a.escalationDescription,Fe=a.configureAutoReminderText,xe=a.getDynamicStatement,Oe=a.reminderStartDateLabel,ke=a.documentDueDateLabel,He=a.reminderFrequencyLabel,je=a.escalationRemindersLabel,Ie=a.escalationTooltip,Pe=a.escalationConditionText,Ee=a.daysText,We=a.dueDataAndRepeatText,ze=a.reminderFrequencyOptions,Ue=a.escalationFrequencyOptions,Ve=a.beforeAfterOptions,Ye=d.useMemo(function(){var e;return(null===(e=N.tabData)||void 0===e?void 0:e.length)?N.tabData:b},[N.tabData]),Je=d.useMemo(function(){return Ye.filter(function(e){var n=g(e.tabName);return!((!Z||ee)&&"assignees"===n)&&(!ie||"reminders"!==n)})},[Ye,Z,ee,ie]),Ge=u(null!==(L=null===(o=Je[0])||void 0===o?void 0:o.tabName)&&void 0!==L?L:""),Ke=Ge[0],Qe=Ge[1],Xe=g(Ke),Ze=d.useMemo(function(){return _(B||h)},[]),$e=u(Ze),en=$e[0],nn=$e[1],rn=u(F||!1),tn=rn[0],an=rn[1],on=u(O||null),ln=on[0],sn=on[1],dn=d.useRef(!1),un=d.useRef(!1),cn=d.useRef(!1),vn=d.useRef(R(Ze)),mn=d.useRef(!!F),pn=d.useRef(S(O||null)),fn=d.useCallback(function(e){dn.current=!0,nn(e)},[]),yn=d.useCallback(function(e){un.current=!0,an(e)},[]),hn=d.useCallback(function(e){cn.current=!0,sn(e)},[]),bn=u(null),Dn=bn[0],gn=bn[1],wn=u([]),An=wn[0],_n=wn[1],Ln=u(de||D),Rn=Ln[0],Sn=Ln[1],Tn=void 0!==ce?ce:An,Nn=void 0!==ve?ve:_n,Cn=void 0!==de?de:Rn,qn=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},Bn=function(){return qn(new Date)},Mn=d.useMemo(function(){return{due_at:ln?ln.toISOString():"",assignee:en.filter(function(e){return!e.isHidden}).flatMap(function(e){return e.assignees||[]}).reduce(function(n,i,r){var t;return e(e({},n),((t={})[r]=i,t))},{})}},[ln,en]);c(function(){void 0!==de&&Sn(de)},[de]),c(function(){Q&&Q().then(function(e){Array.isArray(e)&&e.length>0?gn(e[0]):e&&!Array.isArray(e)&&gn(e)}).catch(function(e){return console.error("Failed to fetch user:",e)})},[]),c(function(){fe&&Je.some(function(e){return e.tabName===fe})&&Qe(fe)},[fe,Je]),c(function(){var e,n;Je.some(function(e){return e.tabName===Ke})||Qe(null!==(n=null===(e=Je[0])||void 0===e?void 0:e.tabName)&&void 0!==n?n:"")},[Je,Ke]),c(function(){if(B){var e=_(B,en),n=R(e),i=R(en);n!==vn.current&&(dn.current&&n!==i||(vn.current=n,dn.current=!1,n!==i&&nn(e)))}},[B,en]),c(function(){if(void 0!==F){var e=!!F;e!==mn.current&&(un.current&&e!==tn||(mn.current=e,un.current=!1,e!==tn&&an(e)))}},[F,tn]),c(function(){if(void 0!==O){var e=null!=O?O:null,n=S(e),i=S(ln);n!==pn.current&&(cn.current&&n!==i||(pn.current=n,cn.current=!1,n!==i&&sn(e)))}},[O,ln]),c(function(){nn(function(i){var r,t=i.filter(function(e){return!e.isHidden}),a=i.find(function(e){return e.isHidden});if(tn){var o=null===(r=null==a?void 0:a.assignees)||void 0===r?void 0:r[0],l=e(e({},o),{id:(null==o?void 0:o.id)||(null==Dn?void 0:Dn.id)||"me",email:(null==o?void 0:o.email)||(null==Dn?void 0:Dn.email)||"",name:(null==o?void 0:o.name)||((null==Dn?void 0:Dn.name)?"".concat(Dn.name," (You)"):"Username (You)"),accessLevel:(null==o?void 0:o.accessLevel)||"Approve",role:(null==o?void 0:o.role)||"Final Approver"}),s=e(e({},a),{headerName:"Final",title:"Final Approval",isMandatory:!0,hasDueDate:!1,dueDate:null,isHidden:!0,assignees:[l]});return A(n(n([],t,!0),[s],!1))}return A(t)})},[tn,Dn]),c(function(){var e=en.flatMap(function(e){return e.assignees||[]}).filter(function(e){return e.email});Sn(function(n){var i=n.length===e.length&&e.every(function(e,i){var r;return(null===(r=n[i])||void 0===r?void 0:r.email)===e.email});return i?n:e.map(function(e,i){var r=n.find(function(n){return n.email===e.email});return r||{id:i+1,name:e.name,email:e.email,reminder_start_date:"",reminder_frequency:{type:"preset",value:""},is_escalation_reminder:!1,days:{type:"preset",value:""},before_or_after:"",escalation_reminder_frequency:{type:"preset",value:""}}})})},[en]);var Fn=en.filter(function(e){return!e.isHidden}),xn=Fn.reduce(function(e,n){if(!n.dueDate)return e;var i=qn(n.dueDate);return!e||i>e?i:e},null),On=xn&&xn>Bn()?xn:Bn(),kn=Fn.find(function(e,n){if(!(0===n||e.isMandatory))return!1;var i=!!e.dueDate,r=(e.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)});return!i||!r}),Hn=!1!==N.showFinalApprovalDueDate,jn=J||(!!kn||Hn&&!ln),In=N.wrapperTitle||"Assign Redline and Manage Reminders",Pn=N.wrapperSubTitle||"Sec 4.1 - Technical Security Information",En=N.wrapperPriority||"High",Wn=N.wrapperPriorityStyles||{backgroundColor:"#DC262618",color:"#DC2626",border:"1px solid #DC262640"};return r("div",e({style:e(e({},y.overlay),V.overlay)},{children:i("div",e({style:e(e(e(e({},y.modal),{transition:"width 0.3s ease, max-width 0.3s ease"}),"reminders"===Xe?{width:"1400px",maxWidth:"95vw"}:{}),V.modal)},{children:[i("div",e({style:e(e({},y.header),V.header)},{children:[i("div",e({style:e(e({},y.headerLeft),V.headerLeft)},{children:[r("span",e({style:e(e({},y.modalTitle),V.modalTitle)},{children:In})),i("div",e({style:e(e({},y.redlineRow),V.redlineRow)},{children:[r("span",e({style:e(e({},y.redlineName),V.redlineName)},{children:Pn})),r("span",e({style:e(e(e({},y.redlineBadge),Wn),V.redlineBadge)},{children:En}))]}))]})),r("button",e({style:e(e({},y.closeBtn),V.closeBtn),onClick:H},{children:r(l,{size:20,color:"#6B7280"})}))]})),r("div",e({style:e(e({},y.tabBar),V.tabBar)},{children:Je.map(function(n){var r=Ke===n.tabName;return i("button",e({style:e(e(e({},y.tab),V.tab),r?e(e({},y.tabActive),V.tabActive):{}),onClick:function(){return Qe(n.tabName)}},{children:[n.tabIcon," ",n.tabName]}),n.tabName)})})),i("div",e({style:e(e({},y.body),V.body)},{children:["assignees"===Xe&&i(t,{children:[!1!==N.showFinalApprovalDueDate&&i("div",e({style:e(e({},y.dueDateBar),V.dueDateBar)},{children:[i("span",e({style:e(e({},y.dueDateLabel),V.dueDateLabel)},{children:["Final Approval due date"," ",r("sup",e({style:{color:"#DC2626",marginLeft:2}},{children:"*"}))]})),r("div",e({style:e(e({},y.dueDateInputWrap),V.dueDateInputWrap)},{children:r(p,{value:ln?ln.toISOString().slice(0,10):"",onChange:function(e){var n="function"==typeof e?e(ln):e;n&&qn(n)<On?null==P||P("Final approval due date cannot be before the latest level due date"):hn(n?qn(n):null)},minDate:On,disabled:K.disableDueDates})})),i("span",e({style:e(e({},y.requiredToProceeed),V.requiredToProceeed)},{children:[r(s,{size:14,color:"#6B7280"})," Required to proceed"]}))]})),r(v,{levels:en,totalLevels:z,requireFinalApproval:tn,setLevels:fn,setRequireFinalApproval:function(e){yn(e)},fetchUsers:j,onValidationError:P,customStyles:V,finalApprovalDueDate:ln,displayConfig:K})]}),"reminders"===Xe&&r(f,e({data:Mn,schedules:Tn,setSchedules:Nn,remainderOwners:Cn,setRemainderOwners:function(e){var n="function"==typeof e?e(Cn):e;ue?ue(n):Sn(n)},handelSendNow:function(e,n){me&&me(e||Tn,n||Cn)},showPreviewEmail:null!=pe&&pe},void 0!==ye&&{labels:ye},void 0!==he&&{colors:he},void 0!==be&&{chipColor:be},void 0!==De&&{assignees:De},void 0!==ge&&{fallbackRecipients:ge},void 0!==we&&{recipientsColor:we},void 0!==Ae&&{manualReminderTitle:Ae},void 0!==_e&&{manualReminderDescription:_e},void 0!==Le&&{lastReminderText:Le},void 0!==Re&&{selectRecipientsLabel:Re},void 0!==Se&&{previewEmailButtonLabel:Se},void 0!==Te&&{sendNowButtonLabel:Te},void 0!==Ne&&{reminderSuccessTitle:Ne},void 0!==Ce&&{reminderSuccessDescription:Ce},void 0!==qe&&{escalationTitle:qe},void 0!==Be&&{escalationTitleTooltip:Be},void 0!==Me&&{escalationDescription:Me},void 0!==Fe&&{configureAutoReminderText:Fe},void 0!==xe&&{getDynamicStatement:xe},void 0!==Oe&&{reminderStartDateLabel:Oe},void 0!==ke&&{documentDueDateLabel:ke},void 0!==He&&{reminderFrequencyLabel:He},void 0!==je&&{escalationRemindersLabel:je},void 0!==Ie&&{escalationTooltip:Ie},void 0!==Pe&&{escalationConditionText:Pe},void 0!==Ee&&{daysText:Ee},void 0!==We&&{dueDataAndRepeatText:We},void 0!==ze&&{reminderFrequencyOptions:ze},void 0!==Ue&&{escalationFrequencyOptions:Ue},void 0!==Ve&&{beforeAfterOptions:Ve})),"review"===Xe&&r(m,{levels:en,reviewData:q,showApproveAndMoveToNextLevelButton:E,onApproveAndMoveToNextLevel:W})]})),!se&&(!te||!oe)&&i("div",e({style:e(e({},y.footer),V.footer)},{children:[!te&&r("button",e({style:e(e(e({},y.clearBtn),V.clearBtn),J?V.actionBtnDisabled:{}),onClick:function(){fn(w(h.map(function(n){return e(e({},n),{assignees:[],dueDate:null})}))),yn(!1),hn(null)},disabled:J},{children:"Clear"})),!oe&&r("button",e({style:e(e(e({},y.saveBtn),V.saveBtn),jn?e({opacity:.55,cursor:"not-allowed"},V.actionBtnDisabled):{}),onClick:function(){if(jn)J||null==P||P(function(){if(Hn&&!ln)return"Final approval due date is required";if(!kn)return"Please fill all required fields before saving";var e=Fn.indexOf(kn)+1,n=[kn.dueDate?null:"due date",(kn.assignees||[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)})?null:"assignee"].filter(Boolean);return"Level ".concat(e," ").concat(n.join(" and ")," ").concat(n.length>1?"are":"is"," required")}());else{var e=A(en.filter(function(e){return!e.isHidden}));null==M||M(e),null==x||x(tn),null==k||k(ln),null==I||I({levels:e,requireFinalApproval:tn,finalApprovalDueDate:ln,activeTab:Xe,schedules:Tn,remainderOwners:Cn})}},disabled:jn},{children:"Save Changes"}))]}))]}))}))}export{T as AssignReminderWrapper,h 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 n,jsx as r}from"react/jsx-runtime";import{ChevronDown as t}from"lucide-react";import{useState as o,useRef as i,useEffect as l}from"react";function a(a){var d=a.value,c=a.options,s=a.onChange,
|
|
1
|
+
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as n,jsx as r}from"react/jsx-runtime";import{ChevronDown as t}from"lucide-react";import{useState as o,useRef as i,useEffect as l}from"react";function a(a){var d=a.value,c=a.options,s=a.onChange,u=a.disabled,p=void 0!==u&&u,f=o(!1),x=f[0],b=f[1],g=i(null),m=function(e){return(e||"").trim().toLowerCase().replace(/\s*&\s*/g," and ").replace(/\s+/g," ")},v=c.find(function(e){return m(e.label)===m(d)})||c[0];return l(function(){function e(e){g.current&&!g.current.contains(e.target)&&b(!1)}return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]),n("div",e({ref:g,style:{position:"relative",backgroundColor:"#FFFFFF",borderRadius:"5px"}},{children:[n("div",e({onClick:function(){p||b(!x)},style:{display:"flex",alignItems:"center",gap:"6px",cursor:p?"not-allowed":"pointer",background:"transparent",padding:"2px 4px",userSelect:"none",opacity:p?.65:1}},{children:[v.icon&&r("span",e({style:{display:"flex",alignItems:"center"}},{children:v.icon})),r("span",e({style:{fontSize:"14px"}},{children:v.label})),r(t,{size:14,style:{flexShrink:0}})]})),x&&!p&&r("div",e({style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"white",border:"1px solid #CBD5E1",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)",zIndex:50,minWidth:"140px",overflow:"hidden"}},{children:c.map(function(t,o){return n("div",e({onClick:function(){s(t.label),b(!1)},style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",cursor:"pointer",fontSize:"14px",backgroundColor:(null==v?void 0:v.label)===t.label?"#F1F5F9":"transparent"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor=(null==v?void 0:v.label)===t.label?"#F1F5F9":"transparent"}},{children:[t.icon&&r("span",e({style:{display:"flex",alignItems:"center"}},{children:t.icon})),r("span",{children:t.label})]}),o)})}))]}))}export{a as default};
|
|
2
2
|
//# sourceMappingURL=CustomDropdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as n,__assign as i,__spreadArray as
|
|
1
|
+
import{__awaiter as e,__generator as n,__assign as i,__spreadArray as o}from"../../../_virtual/_tslib.js";import{jsxs as l,jsx as r}from"react/jsx-runtime";import{useState as t,useEffect as d}from"react";import s from"./CustomDropdown.js";import{AddUserPopup as a}from"./AddUserPopup.js";function u(u){var c,p,v,f,b,m=this,g=u.assignees,x=u.onAssigneeChange,h=u.accessLevelOptions,C=u.fetchUsers,y=u.wrapperEl,w=u.levelDetails,A=u.displayConfig,U=void 0===A?{}:A,L=t(""),k=L[0],N=L[1],B=t([]),D=B[0],E=B[1],R=t(null),S=R[0],M=R[1],T=function(e){var n;return e.accessLevel||e.role||""||(null===(n=h[0])||void 0===n?void 0:n.label)||""};d(function(){if(!U.disableAddUser&&k.trim()){var i=setTimeout(function(){return e(m,void 0,void 0,function(){var e,i,o;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,C(k)];case 1:return e=n.sent(),i=new Set(g.map(function(e){return e.id})),E(e.filter(function(e){return!i.has(e.id)})),[3,3];case 2:return o=n.sent(),console.error("[LevelData]: fetchUser error:",o),E([]),[3,3];case 3:return[2]}})})},300);return function(){return clearTimeout(i)}}E([])},[k,g]);return l("div",i({style:{borderTop:"1px solid #CBD5E1",padding:"20px"}},{children:[r("span",i({style:{fontWeight:600,marginBottom:"8px",fontSize:"14px"}},{children:"Assignee Emails"})),l("div",i({style:{border:"1px solid #CBD5E1",borderRadius:"8px",padding:"8px",marginTop:"10px",display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},{children:[g.map(function(e){var n=!!e.notes&&"string"==typeof e.notes&&!!e.notes.trim();return l("div",i({style:{display:"flex",alignItems:"center",gap:"6px",background:"#E9D5FF",borderRadius:"10px",padding:"2px 8px",fontSize:"12px"}},{children:[r("span",i({style:{padding:"4px"}},{children:e.name})),r(s,{value:T(e),options:h,onChange:function(n){return o=e.id,l=n,void(U.disableAccessLevelChange||x(g.map(function(e){return e.id===o?i(i({},e),{accessLevel:l,role:l}):e})));var o,l},disabled:U.disableAccessLevelChange}),r("div",i({style:{position:"relative",display:"inline-flex",backgroundColor:"white",borderRadius:"3px",padding:1}},{children:r("button",i({type:"button",disabled:U.disableNotes,onClick:function(){return function(e){U.disableNotes||M(i({},e))}(e)},style:{border:"none",background:"transparent",cursor:U.disableNotes?"not-allowed":"pointer",padding:"2px",display:"flex",alignItems:"center",color:n?"#7C3AED":"#C4B5FD",opacity:U.disableNotes?.6:1}},{children:r("svg",i({width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:r("path",{d:"M3.03353 3.90755H5.9502M3.03353 5.94922H7.7002M4.59905 9.44922H8.4002C9.38029 9.44922 9.87033 9.44922 10.2447 9.25848C10.574 9.0907 10.8417 8.82299 11.0095 8.4937C11.2002 8.11936 11.2002 7.62931 11.2002 6.64922V3.49922C11.2002 2.51913 11.2002 2.02908 11.0095 1.65474C10.8417 1.32545 10.574 1.05774 10.2447 0.889957C9.87033 0.699219 9.38029 0.699219 8.4002 0.699219H3.5002C2.5201 0.699219 2.03006 0.699219 1.65571 0.889957C1.32643 1.05774 1.05871 1.32545 0.890934 1.65474C0.700195 2.02908 0.700195 2.51913 0.700195 3.49922V10.8116C0.700195 11.1224 0.700195 11.2778 0.763912 11.3577C0.819325 11.4271 0.903352 11.4675 0.992177 11.4674C1.09431 11.4673 1.21567 11.3702 1.45839 11.176L2.8499 10.0628C3.13416 9.83538 3.27629 9.72167 3.43456 9.64082C3.57498 9.56908 3.72444 9.51665 3.8789 9.48495C4.053 9.44922 4.23502 9.44922 4.59905 9.44922Z",stroke:"#98A2B3","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"})}))}))})),r("button",i({disabled:U.disableRemoveUser,style:{border:"none",background:"transparent",cursor:U.disableRemoveUser?"not-allowed":"pointer",padding:"2px",display:"flex",alignItems:"center",fontSize:"12px",opacity:U.disableRemoveUser?.45:1},onClick:function(){return n=e.id,void(U.disableRemoveUser||(x(g.filter(function(e){return e.id!==n})),(null==S?void 0:S.id)===n&&M(null)));var n},"aria-label":"Remove ".concat(e.name)},{children:"✕"}))]}),e.id)}),r("input",{type:"text",value:k,placeholder:"Search users...",onChange:function(e){U.disableAddUser||N(e.target.value)},disabled:U.disableAddUser,style:{border:"none",outline:"none",flex:1,minWidth:"150px",fontSize:"12px",cursor:U.disableAddUser?"not-allowed":"text",opacity:U.disableAddUser?.65:1}})]})),D.length>0&&r("div",i({style:{border:"1px solid #CBD5E1",borderRadius:"8px",marginTop:"8px"}},{children:D.map(function(e){return l("div",i({style:{padding:"8px",cursor:U.disableAddUser?"not-allowed":"pointer",opacity:U.disableAddUser?.65:1},onClick:function(){return function(e){var n,l,r,t,d,s,a,u;U.disableAddUser||g.some(function(n){return n.id===e.id})||(x(o(o([],g,!0),[i(i({},e),{accessLevel:null!==(l=null===(n=h[0])||void 0===n?void 0:n.label)&&void 0!==l?l:"",role:null!==(t=null===(r=h[0])||void 0===r?void 0:r.label)&&void 0!==t?t:"",notes:"",sendMailNow:!1})],!1)),N(""),E([]),M(i(i({},e),{accessLevel:null!==(s=null===(d=h[0])||void 0===d?void 0:d.label)&&void 0!==s?s:"",role:null!==(u=null===(a=h[0])||void 0===a?void 0:a.label)&&void 0!==u?u:""})))}(e)}},{children:[e.name,e.email&&r("span",i({style:{marginLeft:"8px",color:"#6B7280",fontSize:"11px"}},{children:e.email}))]}),e.id)})})),S&&r(a,{user:S,userLevel:{head:null!==(c=null==w?void 0:w.head)&&void 0!==c?c:"",title:null!==(p=null==w?void 0:w.title)&&void 0!==p?p:""},accessLevel:null!==(b=null!==(v=S.accessLevel)&&void 0!==v?v:null===(f=h[0])||void 0===f?void 0:f.label)&&void 0!==b?b:"",wrapperEl:y,onBackToEditing:function(){S&&(x(g.map(function(e){return e.id===S.id?i(i({},e),{notes:"",sendMailNow:!1}):e})),M(null))},onSendLater:function(e){U.disableNotes||S&&(x(g.map(function(n){return n.id===S.id?i(i({},n),{notes:e,sendMailNow:!1}):n})),M(null))},onSendNow:function(e){U.disableNotes||S&&(x(g.map(function(n){return n.id===S.id?i(i({},n),{notes:e,sendMailNow:!0}):n})),M(null))},disabled:U.disableNotes})]}))}export{u as default};
|
|
2
2
|
//# sourceMappingURL=LevelData.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as n,jsx as t,Fragment as l}from"react/jsx-runtime";import i from"react";import{Info as o,Check as r,Hourglass as d,X as s,CircleCheck as a,MinusCircle as p,User as c,ArrowRight as g,CheckCircle as v,FileCheck as x,LucidePen as u}from"lucide-react";import{DEFAULT_REVIEW_STATUS_STYLES as f}from"../styles/ReviewStatusStyles.js";var h=function(e){var n=e.trim().split(/\s+/);return 1===n.length?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()},y=function(e){for(var n=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],t=0,l=0;l<e.length;l++)t=e.charCodeAt(l)+((t<<5)-t);return n[Math.abs(t)%n.length]},F=function(e){var n=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof n&&n.trim()?n:"No role assigned"};function m(l){var r=l.levels,d=l.reviewData,s=void 0===d?{}:d,a=l.showApproveAndMoveToNextLevelButton,p=void 0!==a&&a,c=l.onApproveAndMoveToNextLevel,g=r.map(function(e,n){var t,l,i,o=null!==(l=null!==(t=s[n])&&void 0!==t?t:s[e.headerName])&&void 0!==l?l:{},r=(null!==(i=e.assignees)&&void 0!==i?i:[]).map(function(e){return{user:e,approved:!0===o[String(e.id)]||!0===o[String(e.email)]||"approved"===e.action||!0===e.approved,rejected:"rejected"===o[String(e.id)]||"rejected"===o[String(e.email)]||"rejected"===e.action}}),d="not_started";if(!0===e.isApproved)d="approved";else if(!0===e.isRejected)d="rejected";else if("approved"===e.status||"completed"===e.status)d="approved";else if("rejected"===e.status)d="rejected";else{var a=r.length>0&&r.every(function(e){return e.approved}),p=r.some(function(e){return e.rejected});a?d="approved":p&&(d="rejected")}return{level:e,assigneeStatuses:r,status:d}}),v=!1,x=g.map(function(n){var t="waiting",l=!0===n.level.isHidden;return"approved"===n.status?t="approved":"rejected"===n.status?(t="rejected",v=!0):n.level.isMandatory||l?v||(t="pending",v=!0):t="optional",e(e({},n),{extendedStatus:t,isFinalApproval:l})}),u=function(e){return e.filter(function(e){return"approved"===e.status}).length}(g),h=g.length;return n("div",e({style:{display:"flex",flexDirection:"column",gap:24}},{children:[n("div",{children:[n("div",e({style:f.progressHeader},{children:[t("span",e({style:f.progressTitle},{children:"Approval Progress"})),n("span",e({style:f.progressCount},{children:[u," of ",h," level",1!==h?"s":""," complete"]}))]})),t("div",e({style:f.progressBarTrack},{children:x.map(function(n,l){var i,o="approved"===n.extendedStatus,r="rejected"===n.extendedStatus,d="optional"===n.extendedStatus,s=0===l,a=l===h-1;return!(null===(i=n.level)||void 0===i?void 0:i.assignees)||!Array.isArray(n.level.assignees)||n.level.assignees.length<1?null:t("div",{style:e(e({},f.progressSegment),{backgroundColor:o?"#6366F1":r?"#EF4444":d?"#F1F5F9":"#E5E7EB",borderRadius:s&&a?"999px":s?"999px 0 0 999px":a?"0 999px 999px 0":"0",marginRight:a?0:3})},l)})})),t("div",e({style:f.progressLabels},{children:x.map(function(n,l){return t("span",e({style:e(e({},f.progressLabel),{color:"approved"===n.extendedStatus?"#6366F1":"rejected"===n.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===n.extendedStatus||"rejected"===n.extendedStatus?600:400})},{children:n.level.assignees&&n.level.assignees.length>0?"".concat(n.level.headerName," - ").concat(n.level.title):""}),l)})}))]}),n("div",e({style:{display:"flex",flexDirection:"column",gap:0}},{children:[t("div",e({style:f.sectionHeadingRow},{children:n("div",e({style:{display:"flex",alignItems:"center",gap:6}},{children:[t("span",e({style:f.sectionTitle},{children:"Approval Levels"})),t(o,{size:15,color:"#9CA3AF"})]}))})),t("div",e({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:x.map(function(l,o){var r,d,s=o===x.length-1,a=l.isFinalApproval,g=x[o+1],v=null==g?void 0:g.isFinalApproval,u=g&&!g.level.isMandatory&&!v;return n(i.Fragment,a?{children:[n("div",e({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[t("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),t("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),t("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),t("div",e({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),t(E,{reviewLevel:l})]}:{children:[t(b,{reviewLevel:l,levelIndex:o,nextLevel:null!==(r=null==g?void 0:g.level)&&void 0!==r?r:null,showApproveAndMoveToNextLevelButton:p,onApproveAndMoveToNextLevel:c}),!s&&!v&&g.level.assignees&&(null===(d=g.level.assignees)||void 0===d?void 0:d.length)>0&&n("div",e({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[t("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),t("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:u?"optional":"then"})),t("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},o)})}))]})),t(S,{levels:r})]}))}function b(l){var i,a=l.reviewLevel,p=l.levelIndex,c=l.nextLevel,g=l.showApproveAndMoveToNextLevelButton,v=l.onApproveAndMoveToNextLevel,x=a.level,u=a.assigneeStatuses,f=a.extendedStatus,h=g&&"pending"===f&&!!v,y=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:t(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:t(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:t(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:t(s,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:t(o,{size:14}),text:"Optional"}}[f])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:t(d,{size:14}),text:"Waiting"},F="approved"===f?"1px solid #D1FAE5":"rejected"===f?"1px solid #FCA5A5":"optional"===f?"1px dashed #CBD5E1":"1px solid #E5E7EB",m="approved"===f?"#F0FDF4":"rejected"===f?"#FEF2F2":"#F8FAFC";return!x.assignees||!Array.isArray(x.assignees)||x.assignees.length<1?null:n("div",e({style:{backgroundColor:"#FFFFFF",border:F,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[n("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:m,borderBottom:F,padding:"12px 16px"}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[t(A,{name:x.headerName}),t("span",e({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:x.title}))]})),n("div",e({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[h&&n("button",e({type:"button",onClick:function(){return null==v?void 0:v({level:x,levelIndex:p,nextLevel:c})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[t(r,{size:13}),"Approve & Move to Next Level"]})),n("div",e({style:{backgroundColor:y.bg,color:y.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[y.icon,y.text]}))]}))]})),t("div",e({style:{padding:"16px"}},{children:u.length>0?t("div",e({style:{display:"flex",flexDirection:"column",gap:16}},{children:u.map(function(e,n){var l;return t(C,{assigneeStatus:e,extendedStatus:f},null!==(l=e.user.id)&&void 0!==l?l:n)})})):t("div",e({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function E(l){var i,a,p,c,g=l.reviewLevel,v=g.assigneeStatuses,x=g.extendedStatus,u=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:t(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:t(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:t(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:t(s,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:t(o,{size:14}),text:"Optional"}}[x])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:t(d,{size:14}),text:"Waiting"},f=null===(a=v[0])||void 0===a?void 0:a.user;null==f||f.email;var m=F(f);return n("div",e({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[f?n("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[t("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:y(null!==(p=f.id)&&void 0!==p?p:f.name).bg,color:y(null!==(c=f.id)&&void 0!==c?c:f.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:h(f.name)})),n("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[t("span",e({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:f.name})),n("span",e({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",m]})),t("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):t("span",e({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),n("div",e({style:{backgroundColor:u.bg,color:u.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[u.icon,u.text]}))]}))}function C(i){var o,r=i.assigneeStatus,d=i.extendedStatus,c=r.user,g=r.approved||"approved"===c.action,v=r.rejected||"rejected"===c.action,x=h(c.name),u=y(null!==(o=c.id)&&void 0!==o?o:c.name),f=F(c);return n("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[t("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:u.bg,color:u.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:x})),n("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[t("span",e({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:c.name})),t("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:f}))]})),t("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:c.email}))]}))]})),t("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:g?t(a,{size:20,color:"#16A34A",strokeWidth:1.5}):v?t(s,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===d?n(l,{children:[t("span",{style:{fontSize:"13px",color:"#4B5563"}}),t(p,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):t(p,"optional"===d?{size:20,color:"#CBD5E1",strokeWidth:1.5}:{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function A(n){var l=n.name,i=y(l);return t("span",e({style:{backgroundColor:i.bg,color:i.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:l}))}var z=function(e){switch(e){case 0:return t(u,{size:16,color:"#475569"});case 1:return t(x,{size:16,color:"#475569"});case 2:return t(c,{size:16,color:"#475569"});default:return t(v,{size:16,color:"#475569"})}};function S(l){var o=l.levels.filter(function(e){var n,t;return(null!==(t=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==t?t:0)>0});return n("div",e({style:f.flowBox},{children:[t("span",e({style:f.flowTitle},{children:"Current Approval Flow"})),o.length>0?t("div",e({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:o.map(function(l,r){var d,s=l.isHidden,a=!l.isMandatory&&!s,p=s?t(c,{size:16,color:"#475569"}):z(r);return n(i.Fragment,{children:[n("span",e({style:e(e({},f.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:a?"1px dashed #CBD5E1":void 0})},{children:[p,n("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[l.assignees.map(function(l,o){var r,d,s=F(l);return n(i.Fragment,{children:[o>0&&t("span",e({style:{color:"#9CA3AF"}},{children:"/"})),n("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[t("span",e({style:{fontSize:13,color:a?"#64748B":"#374151"}},{children:l.name})),t("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:s}))]}))]},null!==(d=null!==(r=l.id)&&void 0!==r?r:l.email)&&void 0!==d?d:o)}),a&&t("span",e({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<o.length-1&&t(g,{size:16,color:"#9CA3AF"})]},null!==(d=l.id)&&void 0!==d?d:"".concat(l.headerName,"-").concat(r))})})):t("p",e({style:f.flowEmpty},{children:"No owners assigned yet."}))]}))}export{m as default};
|
|
1
|
+
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as l,jsx as n,Fragment as t}from"react/jsx-runtime";import i from"react";import{Info as o,Check as r,Hourglass as d,X as s,CircleCheck as a,MinusCircle as p,User as c,ArrowRight as v,CheckCircle as g,FileCheck as u,LucidePen as x}from"lucide-react";import{DEFAULT_REVIEW_STATUS_STYLES as f}from"../styles/ReviewStatusStyles.js";var h=function(e){var l=e.trim().split(/\s+/);return 1===l.length?l[0].slice(0,2).toUpperCase():(l[0][0]+l[l.length-1][0]).toUpperCase()},y=function(e){for(var l=[{bg:"#FEF9C3",fg:"#854D0E"},{bg:"#DCFCE7",fg:"#166534"},{bg:"#DBEAFE",fg:"#1E40AF"},{bg:"#F3E8FF",fg:"#6B21A8"},{bg:"#FFE4E6",fg:"#9F1239"},{bg:"#FEE2E2",fg:"#991B1B"},{bg:"#E0F2FE",fg:"#0369A1"}],n=0,t=0;t<e.length;t++)n=e.charCodeAt(t)+((n<<5)-n);return l[Math.abs(n)%l.length]},F=function(e){var l=(null==e?void 0:e.role)||(null==e?void 0:e.accessLevel);return"string"==typeof l&&l.trim()?l:"No role assigned"},m=function(e){return!0===e||("string"==typeof e?["approved","completed","complete","done","accepted"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(m(e.approved)||m(e.status)||m(e.action)||m(e.value)))},b=function(e){return"string"==typeof e?["rejected","declined","denied"].includes(e.trim().toLowerCase()):!(!e||"object"!=typeof e)&&(b(e.rejected)||b(e.status)||b(e.action)||b(e.value))};function E(t){var r=t.levels,d=t.reviewData,s=void 0===d?{}:d,a=t.showApproveAndMoveToNextLevelButton,p=void 0!==a&&a,c=t.onApproveAndMoveToNextLevel,v=r.map(function(e,l){var n,t,i,o,r,d,a,p,c=null!==(a=null!==(i=null!==(t=null!==(n=s[l])&&void 0!==n?n:s[e.headerName])&&void 0!==t?t:s[e.title])&&void 0!==i?i:e.isHidden?null!==(d=null!==(r=null!==(o=s.final)&&void 0!==o?o:s.Final)&&void 0!==r?r:s.finalApproval)&&void 0!==d?d:s.final_approval:void 0)&&void 0!==a?a:{},v=c&&"object"==typeof c?c:{},g=(null!==(p=e.assignees)&&void 0!==p?p:[]).map(function(l){var n,t,i,o,r,d,s=null!==(t=null!==(n=v[String(l.id)])&&void 0!==n?n:v[String(l.email)])&&void 0!==t?t:e.isHidden?null!==(d=null!==(r=null!==(o=null!==(i=v.owner)&&void 0!==i?i:v.final)&&void 0!==o?o:v.finalApproval)&&void 0!==r?r:v.final_approval)&&void 0!==d?d:c:void 0;return{user:l,approved:m(s)||m(l.action)||m(l.status)||m(l.approved)||m(l.isApproved),rejected:b(s)||b(l.action)||b(l.status)||b(l.rejected)||b(l.isRejected)}}),u="not_started";if(m(c)||m(e.isApproved)||m(e.approved))u="approved";else if(b(c)||b(e.isRejected)||b(e.rejected))u="rejected";else if(m(e.status))u="approved";else if(b(e.status))u="rejected";else{var x=g.length>0&&g.every(function(e){return e.approved}),f=g.some(function(e){return e.rejected});x?u="approved":f&&(u="rejected")}return{level:e,assigneeStatuses:g,status:u}}),g=!1,u=v.map(function(l){var n="waiting",t=!0===l.level.isHidden;return"approved"===l.status?n="approved":"rejected"===l.status?(n="rejected",g=!0):l.level.isMandatory||t?g||(n="pending",g=!0):n="optional",e(e({},l),{extendedStatus:n,isFinalApproval:t})}),x=function(e){return e.filter(function(e){return"approved"===e.status}).length}(v),h=v.length;return l("div",e({style:{display:"flex",flexDirection:"column",gap:24}},{children:[l("div",{children:[l("div",e({style:f.progressHeader},{children:[n("span",e({style:f.progressTitle},{children:"Approval Progress"})),l("span",e({style:f.progressCount},{children:[x," of ",h," level",1!==h?"s":""," complete"]}))]})),n("div",e({style:f.progressBarTrack},{children:u.map(function(l,t){var i,o="approved"===l.extendedStatus,r="rejected"===l.extendedStatus,d="optional"===l.extendedStatus,s=0===t,a=t===h-1;return!(null===(i=l.level)||void 0===i?void 0:i.assignees)||!Array.isArray(l.level.assignees)||l.level.assignees.length<1?null:n("div",{style:e(e({},f.progressSegment),{backgroundColor:o?"#6366F1":r?"#EF4444":d?"#F1F5F9":"#E5E7EB",borderRadius:s&&a?"999px":s?"999px 0 0 999px":a?"0 999px 999px 0":"0",marginRight:a?0:3})},t)})})),n("div",e({style:f.progressLabels},{children:u.map(function(l,t){return n("span",e({style:e(e({},f.progressLabel),{color:"approved"===l.extendedStatus?"#6366F1":"rejected"===l.extendedStatus?"#EF4444":"#9CA3AF",fontWeight:"approved"===l.extendedStatus||"rejected"===l.extendedStatus?600:400})},{children:l.level.assignees&&l.level.assignees.length>0?"".concat(l.level.headerName," - ").concat(l.level.title):""}),t)})}))]}),l("div",e({style:{display:"flex",flexDirection:"column",gap:0}},{children:[n("div",e({style:f.sectionHeadingRow},{children:l("div",e({style:{display:"flex",alignItems:"center",gap:6}},{children:[n("span",e({style:f.sectionTitle},{children:"Approval Levels"})),n(o,{size:15,color:"#9CA3AF"})]}))})),n("div",e({style:{display:"flex",flexDirection:"column",marginTop:12}},{children:u.map(function(t,o){var r,d,s=o===u.length-1,a=t.isFinalApproval,v=u[o+1],g=null==v?void 0:v.isFinalApproval,x=v&&!v.level.isMandatory&&!g;return l(i.Fragment,a?{children:[l("div",e({style:{display:"flex",alignItems:"center",margin:"16px 0"}},{children:[n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),n("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:"then"})),n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]})),n("div",e({style:{marginBottom:"12px",fontSize:"15px",fontWeight:500,color:"#6B7280"}},{children:"Final Approval"})),n(A,{reviewLevel:t})]}:{children:[n(C,{reviewLevel:t,levelIndex:o,nextLevel:null!==(r=null==v?void 0:v.level)&&void 0!==r?r:null,showApproveAndMoveToNextLevelButton:p,onApproveAndMoveToNextLevel:c}),!s&&!g&&v.level.assignees&&(null===(d=v.level.assignees)||void 0===d?void 0:d.length)>0&&l("div",e({style:{display:"flex",alignItems:"center",margin:"20px 0"}},{children:[n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}}),n("span",e({style:{padding:"0 16px",fontSize:"14px",color:"#6B7280"}},{children:x?"optional":"then"})),n("div",{style:{flex:1,height:"1px",backgroundColor:"#E5E7EB"}})]}))]},o)})}))]})),n(j,{levels:r})]}))}function C(t){var i,a=t.reviewLevel,p=t.levelIndex,c=t.nextLevel,v=t.showApproveAndMoveToNextLevelButton,g=t.onApproveAndMoveToNextLevel,u=a.level,x=a.assigneeStatuses,f=a.extendedStatus,h=v&&"pending"===f&&!!g,y=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:n(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:n(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:n(s,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:n(o,{size:14}),text:"Optional"}}[f])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},F="approved"===f?"1px solid #D1FAE5":"rejected"===f?"1px solid #FCA5A5":"optional"===f?"1px dashed #CBD5E1":"1px solid #E5E7EB",m="approved"===f?"#F0FDF4":"rejected"===f?"#FEF2F2":"#F8FAFC";return!u.assignees||!Array.isArray(u.assignees)||u.assignees.length<1?null:l("div",e({style:{backgroundColor:"#FFFFFF",border:F,borderRadius:"8px",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[l("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:m,borderBottom:F,padding:"12px 16px"}},{children:[l("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[n(S,{name:u.headerName}),n("span",e({style:{fontSize:15,fontWeight:500,color:"#374151"}},{children:u.title}))]})),l("div",e({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[h&&l("button",e({type:"button",onClick:function(){return null==g?void 0:g({level:u,levelIndex:p,nextLevel:c})},style:{border:"1px solid #C7D2FE",backgroundColor:"#EEF2FF",color:"#4F46E5",borderRadius:"8px",padding:"6px 10px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},{children:[n(r,{size:13}),"Approve & Move to Next Level"]})),l("div",e({style:{backgroundColor:y.bg,color:y.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[y.icon,y.text]}))]}))]})),n("div",e({style:{padding:"16px"}},{children:x.length>0?n("div",e({style:{display:"flex",flexDirection:"column",gap:16}},{children:x.map(function(e,l){var t;return n(z,{assigneeStatus:e,extendedStatus:f},null!==(t=e.user.id)&&void 0!==t?t:l)})})):n("div",e({style:{fontSize:14,color:"#6B7280"}},{children:"No assignees added yet"}))}))]}))}function A(t){var i,a,p,c,v=t.reviewLevel,g=v.assigneeStatuses,u=v.extendedStatus,x=null!==(i={approved:{bg:"#ECFDF5",color:"#059669",icon:n(r,{size:14}),text:"Approved"},pending:{bg:"#FFEDD5",color:"#C2410C",icon:n(d,{size:14}),text:"Pending"},waiting:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},rejected:{bg:"#FEF2F2",color:"#DC2626",icon:n(s,{size:14}),text:"Rejected"},optional:{bg:"#F8FAFC",color:"#64748B",icon:n(o,{size:14}),text:"Optional"}}[u])&&void 0!==i?i:{bg:"#F3F4F6",color:"#4B5563",icon:n(d,{size:14}),text:"Waiting"},f=null===(a=g[0])||void 0===a?void 0:a.user;null==f||f.email;var m=F(f);return l("div",e({style:{backgroundColor:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:"8px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[f?l("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[n("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:y(null!==(p=f.id)&&void 0!==p?p:f.name).bg,color:y(null!==(c=f.id)&&void 0!==c?c:f.name).fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"14px"}},{children:h(f.name)})),l("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[n("span",e({style:{fontSize:"15px",fontWeight:400,color:"#374151"}},{children:f.name})),l("span",e({style:{fontSize:"13px",color:"#475569",fontWeight:500}},{children:["Role: ",m]})),n("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:"Will be notified after all levels approve"}))]}))]})):n("span",e({style:{fontSize:14,color:"#6B7280"}},{children:"No owner assigned"})),l("div",e({style:{backgroundColor:x.bg,color:x.color,padding:"4px 10px",borderRadius:"16px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"}},{children:[x.icon,x.text]}))]}))}function z(i){var o,r=i.assigneeStatus,d=i.extendedStatus,c=r.user,v=r.approved||"approved"===c.action,g=r.rejected||"rejected"===c.action,u=h(c.name),x=y(null!==(o=c.id)&&void 0!==o?o:c.name),f=F(c);return l("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[l("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:[n("div",e({style:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:x.bg,color:x.fg,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500,fontSize:"13px"}},{children:u})),l("div",e({style:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[l("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[n("span",e({style:{fontSize:"14px",fontWeight:400,color:"#374151"}},{children:c.name})),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:f}))]})),n("span",e({style:{fontSize:"13px",color:"#6B7280"}},{children:c.email}))]}))]})),n("div",e({style:{display:"flex",alignItems:"center",gap:"12px"}},{children:v?n(a,{size:20,color:"#16A34A",strokeWidth:1.5}):g?n(s,{size:20,color:"#DC2626",strokeWidth:1.5}):"pending"===d?l(t,{children:[n("span",{style:{fontSize:"13px",color:"#4B5563"}}),n(p,{size:20,color:"#9CA3AF",strokeWidth:1.5})]}):n(p,"optional"===d?{size:20,color:"#CBD5E1",strokeWidth:1.5}:{size:20,color:"#9CA3AF",strokeWidth:1.5})}))]}))}function S(l){var t=l.name,i=y(t);return n("span",e({style:{backgroundColor:i.bg,color:i.fg,borderRadius:12,padding:"3px 10px",fontSize:12,fontWeight:500}},{children:t}))}var B=function(e){switch(e){case 0:return n(x,{size:16,color:"#475569"});case 1:return n(u,{size:16,color:"#475569"});case 2:return n(c,{size:16,color:"#475569"});default:return n(g,{size:16,color:"#475569"})}};function j(t){var o=t.levels.filter(function(e){var l,n;return(null!==(n=null===(l=e.assignees)||void 0===l?void 0:l.length)&&void 0!==n?n:0)>0});return l("div",e({style:f.flowBox},{children:[n("span",e({style:f.flowTitle},{children:"Current Approval Flow"})),o.length>0?n("div",e({style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",marginTop:6}},{children:o.map(function(t,r){var d,s=t.isHidden,a=!t.isMandatory&&!s,p=s?n(c,{size:16,color:"#475569"}):B(r);return l(i.Fragment,{children:[l("span",e({style:e(e({},f.flowChip),{display:"flex",alignItems:"center",gap:"8px",border:a?"1px dashed #CBD5E1":void 0})},{children:[p,l("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[t.assignees.map(function(t,o){var r,d,s=F(t);return l(i.Fragment,{children:[o>0&&n("span",e({style:{color:"#9CA3AF"}},{children:"/"})),l("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n("span",e({style:{fontSize:13,color:a?"#64748B":"#374151"}},{children:t.name})),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:s}))]}))]},null!==(d=null!==(r=t.id)&&void 0!==r?r:t.email)&&void 0!==d?d:o)}),a&&n("span",e({style:{fontSize:12,color:"#64748B"}},{children:"Optional"}))]}))]})),r<o.length-1&&n(v,{size:16,color:"#9CA3AF"})]},null!==(d=t.id)&&void 0!==d?d:"".concat(t.headerName,"-").concat(r))})})):n("p",e({style:f.flowEmpty},{children:"No owners assigned yet."}))]}))}export{E as default};
|
|
2
2
|
//# sourceMappingURL=ReviewStatus.js.map
|
package/dist/types/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA2E1B,iBAAS,GAAG,sBAMX;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketPackage.test.d.ts","sourceRoot":"","sources":["../../src/SocketPackage.test.tsx"],"names":[],"mappings":";AA0DA,MAAM,CAAC,OAAO,UAAU,UAAU,gCAiFjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignReminderWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/AssignReminderWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,
|
|
1
|
+
{"version":3,"file":"AssignReminderWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/AssignReminders/AssignReminderWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EACL,0BAA0B,EAC1B,KAAK,EAIN,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,cAAc,EAAE,KAAK,EAiBjC,CAAC;AAsJF,iBAAS,qBAAqB,CAAC,EAC7B,QAAa,EACb,UAAe,EACf,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,mCAAmC,EACnC,2BAA2B,EAC3B,WAAW,EACX,YAAiB,EACjB,QAAgB,EAChB,aAAkB,EAClB,sBAAsB,EACtB,OAAc,EAGd,eAAuB,EACvB,mBAA2B,EAC3B,eAAuB,EACvB,qBAA6B,EAC7B,iBAAyB,EACzB,0BAAkC,EAGlC,aAAa,EACb,eAAe,EAAE,mBAAmB,EACpC,kBAAkB,EAAE,sBAAsB,EAC1C,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,gBAAgB,EAC9B,aAAa,EACb,gBAAgB,EAChB,OAAO,EAGP,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,QAAQ,EACR,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,GACnB,EAAE,0BAA0B,qBAywB5B;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/CustomDropdown.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,iBAAS,cAAc,CAAC,EACpB,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAgB,GACnB,EAAE;IACC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,+
|
|
1
|
+
{"version":3,"file":"CustomDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/CustomDropdown.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,iBAAS,cAAc,CAAC,EACpB,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAgB,GACnB,EAAE;IACC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,+BAwGA;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevelData.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/LevelData.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,UAAU,sBAAuB,SAAQ,cAAc;IACnD,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,SAAS,CAAC,EACf,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAkB,GACrB,EAAE,sBAAsB,+
|
|
1
|
+
{"version":3,"file":"LevelData.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/LevelData.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,UAAU,sBAAuB,SAAQ,cAAc;IACnD,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,SAAS,CAAC,EACf,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAkB,GACrB,EAAE,sBAAsB,+BAqRxB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReviewStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/ReviewStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAIH,iBAAiB,EAEpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReviewStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/AssignReminders/components/ReviewStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAIH,iBAAiB,EAEpB,MAAM,gBAAgB,CAAC;AAoFxB,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACjC,MAAM,EACN,UAAe,EACf,mCAA2C,EAC3C,2BAA2B,GAC9B,EAAE,iBAAiB,qBAuPnB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SocketConfig } from "./SocketManager";
|
|
2
|
+
type Handler<T = any> = (payload: T) => void;
|
|
3
|
+
export default class CwsEvent {
|
|
4
|
+
private static handlers;
|
|
5
|
+
static initialize(config: SocketConfig): void;
|
|
6
|
+
private static dispatch;
|
|
7
|
+
static on<T>(type: string, handler: (payload: T) => void): () => void;
|
|
8
|
+
static off(type: string, handler: Handler): void;
|
|
9
|
+
static emit(type: string, payload: any): void;
|
|
10
|
+
static isInitialized(): boolean;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=CwsEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwsEvent.d.ts","sourceRoot":"","sources":["../../../../src/features/cws/CwsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3E,KAAK,OAAO,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,QAAQ;IAEzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAE1D,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY;IAgBtC,OAAO,CAAC,MAAM,CAAC,QAAQ;IAWvB,MAAM,CAAC,EAAE,CAAC,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI;IAejC,MAAM,CAAC,GAAG,CACN,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO;IAiBpB,MAAM,CAAC,IAAI,CACP,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG;IAYhB,MAAM,CAAC,aAAa;CAIvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
applicationId: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
authToken: string;
|
|
7
|
+
}
|
|
8
|
+
export default function CwsEventProvider({ baseUrl, applicationId, children, authToken, }: Props): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=CwsEventProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwsEventProvider.d.ts","sourceRoot":"","sources":["../../../../src/features/cws/CwsEventProvider.tsx"],"names":[],"mappings":";AAGA,UAAU,KAAK;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,OAAO,EACP,aAAa,EACb,QAAQ,EACR,SAAS,GACZ,EAAE,KAAK,+BAYP"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface SocketEvent {
|
|
2
|
+
type: string;
|
|
3
|
+
payload: any;
|
|
4
|
+
}
|
|
5
|
+
type EventListener = (event: SocketEvent) => void;
|
|
6
|
+
export interface SocketConfig {
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
wakeupUrl?: string;
|
|
9
|
+
applicationId: string;
|
|
10
|
+
authToken: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class SocketManager {
|
|
13
|
+
private static instance;
|
|
14
|
+
private socket;
|
|
15
|
+
private listener?;
|
|
16
|
+
private applicationId;
|
|
17
|
+
private authToken;
|
|
18
|
+
private isInitialized;
|
|
19
|
+
private constructor();
|
|
20
|
+
static getInstance(): SocketManager;
|
|
21
|
+
initialize(config: SocketConfig): Promise<void>;
|
|
22
|
+
private wakeupServer;
|
|
23
|
+
setListener(listener: EventListener): void;
|
|
24
|
+
publish(type: string, payload: any): void;
|
|
25
|
+
disconnect(): void;
|
|
26
|
+
getInitStatus(): boolean;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=SocketManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketManager.d.ts","sourceRoot":"","sources":["../../../../src/features/cws/SocketManager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CAChB;AAED,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAElD,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IAEvC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,aAAa,CAAkB;IAEvC,OAAO;IAEP,MAAM,CAAC,WAAW;IAQZ,UAAU,CAAC,MAAM,EAAE,YAAY;YAoCvB,YAAY;IAmB1B,WAAW,CAAC,QAAQ,EAAE,aAAa;IAInC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAQlC,UAAU;IAIV,aAAa;CAGhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/cws/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCwsEvent.d.ts","sourceRoot":"","sources":["../../../../src/features/cws/useCwsEvent.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,QAWjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viswa-test/creative-workspace-ui-component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
4
4
|
"author": "Viswa Koduru",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,6 +77,11 @@
|
|
|
77
77
|
"require": "./dist/cjs/components/ScopeTree/TreeSidebar.js",
|
|
78
78
|
"types": "./dist/types/components/ScopeTree/TreeSidebar.d.ts"
|
|
79
79
|
},
|
|
80
|
+
"./CwsService": {
|
|
81
|
+
"import": "./dist/features/cws/index.js",
|
|
82
|
+
"require": "./dist/cjs/features/cws/index.js",
|
|
83
|
+
"types": "./dist/types/features/cws/index.d.ts"
|
|
84
|
+
},
|
|
80
85
|
"./lsc-guidelines": {
|
|
81
86
|
"import": "./dist/features/lsc-guidelines/index.js",
|
|
82
87
|
"require": "./dist/cjs/features/lsc-guidelines/index.js",
|