PageSourceSearch

https://cdn.joinhomebase.com/assets/UploadCustomDocument-chunk-DYo975Kw.js

js joinhomebase.com collected 2026-09-24 08:33:32 UTC 24,191 bytes, 2 lines download raw bytes

1import{reactExports as a,jsxRuntimeExports as e}from"./react-core-chunk-B2r03cU8.js";import{PropTypes as r,connect as X,unwrapResult as se,useDispatch as oe}from"./redux-core-chunk-DgWMjMkF.js";import{getEventCoordinates as je,useDndMonitor as ye,MULTIPLIER as ie,Alert_default as Ee,Dialog_default as Ne,Box_default as o,Text_default as b,useTrackUx as A,useDraggable as le,classnames as $,cxHelpers as E,Icon_default as J,updateCustomDocument as Pe,createCustomDocument as Te,useHistory as De,FILLABLE_FORM as z,ACKNOWLEDGEMENT as L,flashNotice as F,archiveCustomDocument as ke,Button_default as Z,useDroppable as Ie,Box as Se,DragOverlay as Me,getCurrentLocationId as Le,getCurrentCompanyId as Re,getIsFetching$1 as Be,analyzeFile as ce,IconButton_default as Ae,cxFunction as Ve,getPdfCustomDocumentPageInfo as He,withUxRoot as Fe,browserHistory as Ue}from"./app-init-chunk-kk_CZVyp.js";import{PDF_FILE_TYPE as ze}from"./constants-chunk-CkszlkHb.js";import{toI18n as p}from"./tracking-chunk-Cdw_Cfie.js";import{EVENT_ACTIONS as V,TRACK_ACTION_TYPES as H,EVENT_CATEGORIES as Oe,PRODUCT_AREAS as $e}from"./app-bundle-B0YfsjKz.js";import{TooltipWrapper as Ze}from"./TooltipWrapper-chunk-D2OzKPpA.js";import{Page as qe,Document as We,__webpack_exports__version as Ye,__webpack_exports__GlobalWorkerOptions as Ge}from"./index-chunk-CHcZPdoi.js";import{useDropzone as Ke}from"./index-chunk-BC6FgSWo.js";import{DEFAULT_ACCEPTED_FILE_TYPES as Xe}from"./constants-chunk-DujXxGz8.js";try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="59ea4cc2-292e-4677-9a15-f29aea99e96e",t._sentryDebugIdIdentifier="sentry-dbid-59ea4cc2-292e-4677-9a15-f29aea99e96e")})()}catch{}const Je=t=>{let{activatorEvent:i,draggingNodeRect:s,transform:n}=t;if(s&&i){const l=je(i);if(!l)return n;const c=l.x-s.left,m=l.y-s.top;return{...n,x:n.x+c-s.width/2,y:n.y+m-s.height/2}}return n},Qe=["signature","date","text"];function et({coords:t,getCoordinates:i,updateCoordinates:s}){const[n,l]=a.useState(null),c=a.useRef({x:0,y:0});a.useEffect(()=>{const g=u=>{c.current={x:u.clientX,y:u.clientY}};return window.addEventListener("pointermove",g),()=>window.removeEventListener("pointermove",g)},[]);const m=a.useCallback(g=>{const u=g.active.data.current;Qe.includes(u?.type??"")&&l(u??null)},[]),f=a.useCallback(g=>{if(!n)return;const{over:u,delta:h}=g;if(!u?.id?.toString().startsWith("pdf-page-")){l(null);return}const d=parseInt(u.id.toString().replace("pdf-page-",""),10),x=document.getElementsByClassName("react-pdf__Page__canvas")[d],v=x.getBoundingClientRect(),w=document.getElementsByClassName("Preview--wrapper")[0];if(n.panel){const T=Math.floor(Math.random()*ie),D=c.current.x-v.x-w.offsetWidth/2,k=c.current.y-v.y-w.offsetHeight/2,N=Math.round(D),C=Math.round(k);i({id:T,type:n.type,pageNumber:d+1,xPts:N,yPts:x.offsetHeight-C})}else{const T=(n.xPts??0)+h.x,D=(n.yPts??0)+h.y,k=Math.round(T),N=Math.round(D),C=t.find(R=>R.id===n.id);C&&(Object.assign(C,{xPts:k,yPts:x.offsetHeight-N}),s([...t]))}l(null)},[n,t,i,s]),_=a.useCallback(()=>{l(null)},[]);return ye({onDragStart:m,onDragEnd:f,onDragCancel:_}),{activeDragData:n}}const tt=()=>e.jsx(Ee,{variant:"info",children:p("new_hire.settings.edit_panel.draggable_section.acknowledge_content")}),de=({open:t,handleArchive:i,handleClose:s})=>e.jsx(Ne,{title:p("new_hire.settings.custom_document_editor.delete_modal.title"),buttons:[{label:p("new_hire.settings.custom_document_editor.delete_modal.delete"),variant:"primaryDestructive",onClick:i},{label:p("new_hire.settings.custom_document_editor.delete_modal.cancel"),variant:"secondary",onClick:s}],open:t,onClose:s,children:()=>e.jsx(o,{maxw:400,children:e.jsx(o,{mt:"md",children:e.jsx(b,{variant:"body",color:"primary",children:p("new_hire.settings.custom_document_editor.delete_modal.body")})})})});de.propTypes={open:r.bool,handleArchive:r.func.isRequired,handleClose:r.func.isRequired};const st="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20448%20512'%20fill='%2352258f'%3e%3c!--!%20Font%20Awesome%20Pro%206.2.1%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20(Commercial%20License)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M212.7%204.688l-144%20144c-6.25%206.25-6.25%2016.38%200%2022.62s16.38%206.25%2022.62%200L208%2054.63V336c0%208.844%207.156%2016%2016%2016s16-7.156%2016-16V54.63l116.7%20116.7c6.25%206.25%2016.38%206.25%2022.62%200s6.25-16.38%200-22.62l-144-144C232.2%201.562%20228.1%200%20224%200S215.8%201.562%20212.7%204.688zM416%20336v96c0%2026.47-21.53%2048-48%2048h-288C53.53%20480%2032%20458.5%2032%20432v-96C32%20327.2%2024.84%20320%2016%20320S0%20327.2%200%20336v96C0%20476.1%2035.88%20512%2080%20512h288c44.13%200%2080-35.88%2080-80v-96c0-8.844-7.156-16-16-16S416%20327.2%20416%20336z'/%3e%3c/svg%3e",nt="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5%200.0449219C5.41421%200.0449219%205.75%200.350109%205.75%200.726576V1.86267H12.25V0.726576C12.25%200.350109%2012.5858%200.0449219%2013%200.0449219C13.4142%200.0449219%2013.75%200.350109%2013.75%200.726576V1.86267H15C16.5188%201.86267%2017.75%202.98169%2017.75%204.36207V15.2685C17.75%2016.6489%2016.5188%2017.7679%2015%2017.7679H3C1.48122%2017.7679%200.25%2016.6489%200.25%2015.2685V4.36207C0.25%202.98169%201.48122%201.86267%203%201.86267H4.25V0.726576C4.25%200.350109%204.58579%200.0449219%205%200.0449219ZM4.25%203.22598H3C2.30964%203.22598%201.75%203.73462%201.75%204.36207V7.3159H16.25V4.36207C16.25%203.73462%2015.6904%203.22598%2015%203.22598H13.75V4.36207C13.75%204.73853%2013.4142%205.04372%2013%205.04372C12.5858%205.04372%2012.25%204.73853%2012.25%204.36207V3.22598H5.75V4.36207C5.75%204.73853%205.41421%205.04372%205%205.04372C4.58579%205.04372%204.25%204.73853%204.25%204.36207V3.22598ZM16.25%208.67921H1.75V15.2685C1.75%2015.896%202.30964%2016.4046%203%2016.4046H15C15.6904%2016.4046%2016.25%2015.896%2016.25%2015.2685V8.67921Z'%20fill='%231B1C1E'/%3e%3c/svg%3e",at="data:image/svg+xml,%3csvg%20width='18'%20height='16'%20viewBox='0%200%2018%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.9697%201.51704C12.3671%200.246924%2014.6329%200.246924%2016.0303%201.51704C17.4278%202.78716%2017.4278%204.84642%2016.0303%206.11654L5.53033%2015.6597C5.38968%2015.7875%205.19891%2015.8593%205%2015.8593H1C0.585786%2015.8593%200.25%2015.5542%200.25%2015.1777V11.5422C0.25%2011.3614%200.329018%2011.188%200.46967%2011.0602L9.96932%202.42623L10.9697%201.51704ZM10.5%203.87192L1.75%2011.8246V14.496H4.68934L13.4393%206.54341L10.5%203.87192ZM14.5%205.5794L11.5607%202.90791L12.0303%202.48104C12.842%201.74333%2014.158%201.74333%2014.9697%202.48104C15.7813%203.21875%2015.7813%204.41482%2014.9697%205.15253L14.5%205.5794Z'%20fill='%231B1C1E'/%3e%3c/svg%3e",rt="data:image/svg+xml,%3csvg%20width='26'%20height='26'%20viewBox='0%200%2026%2026'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%202C6.92487%202%202%206.92487%202%2013C2%2019.0751%206.92487%2024%2013%2024C19.0751%2024%2024%2019.0751%2024%2013C24%206.92487%2019.0751%202%2013%202ZM0%2013C0%205.8203%205.8203%200%2013%200C20.1797%200%2026%205.8203%2026%2013C26%2020.1797%2020.1797%2026%2013%2026C5.8203%2026%200%2020.1797%200%2013ZM11.9998%208.33366C11.9998%207.78137%2012.4476%207.33366%2012.9998%207.33366H13.0132C13.5655%207.33366%2014.0132%207.78137%2014.0132%208.33366C14.0132%208.88594%2013.5655%209.33366%2013.0132%209.33366H12.9998C12.4476%209.33366%2011.9998%208.88594%2011.9998%208.33366ZM13.0002%2013C13.5524%2013%2014.0002%2013.4477%2014.0002%2014V19.3333C14.0002%2019.8856%2013.5524%2020.3333%2013.0002%2020.3333C12.4479%2020.3333%2012.0002%2019.8856%2012.0002%2019.3333V14C12.0002%2013.4477%2012.4479%2013%2013.0002%2013Z'%20fill='%2300BCCC'/%3e%3c/svg%3e",ot="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7%201.09375C3.96243%201.09375%201.5%203.55618%201.5%206.59375C1.5%209.63132%203.96243%2012.0938%207%2012.0938C10.0376%2012.0938%2012.5%209.63132%2012.5%206.59375C12.5%203.55618%2010.0376%201.09375%207%201.09375ZM0.5%206.59375C0.5%203.0039%203.41015%200.09375%207%200.09375C10.5899%200.09375%2013.5%203.0039%2013.5%206.59375C13.5%2010.1836%2010.5899%2013.0938%2
107%2013.0938C3.41015%2013.0938%200.5%2010.1836%200.5%206.59375ZM6.49992%204.26009C6.49992%203.98395%206.72378%203.76009%206.99992%203.76009H7.00659C7.28273%203.76009%207.50659%203.98395%207.50659%204.26009C7.50659%204.53623%207.28273%204.76009%207.00659%204.76009H6.99992C6.72378%204.76009%206.49992%204.53623%206.49992%204.26009ZM6.99984%206.09375C7.27598%206.09375%207.49984%206.31761%207.49984%206.59375V9.26042C7.49984%209.53656%207.27598%209.76042%206.99984%209.76042C6.72369%209.76042%206.49984%209.53656%206.49984%209.26042V6.59375C6.49984%206.31761%206.72369%206.09375%206.99984%206.09375Z'%20fill='%231B1C1E'/%3e%3c/svg%3e",it="data:image/svg+xml,%3csvg%20width='13'%20height='16'%20viewBox='0%200%2013%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.36042%2016V3.028H12.0064V0.658999H0.0234155V3.028H4.66942V16H7.36042Z'%20fill='%231B1C1E'/%3e%3cpath%20d='M-0.620584%2019.059H12.6504V19.519H-0.620584V19.059Z'%20fill='%231B1C1E'/%3e%3c/svg%3e",{cx:P}=E("DraggableField"),O=({image:t="",label:i="",type:s="",underline:n=!1})=>{const l=a.useId(),c=A(),{attributes:m,listeners:f,setNodeRef:_,isDragging:g}=le({id:`palette-${s}-${l}`,data:{type:s,panel:!0}}),u=a.useCallback(()=>{c(V.BUTTON_CLICKED,H.CLICK,{button_text:s})},[c,s]);return e.jsx(o,{className:P("parent-wrapper"),onMouseDown:u,children:e.jsxs(o,{ref:_,className:$(P("wrapper",s),{draggable:g}),...m,...f,children:[e.jsx(o,{className:P("dot-wrapper"),children:Array(4).fill().map((h,d)=>e.jsxs(o,{className:P("two-dots-wrapper"),children:[e.jsx(o,{className:P("dot")}),e.jsx(o,{className:P("dot")})]},d))}),e.jsxs(o,{className:P("text-icon-wrapper"),children:[e.jsx("img",{src:new URL(Object.assign({"../images/arrow-up-from-bracket-light.svg":st,"../images/calendar.svg":nt,"../images/edit-pencil.svg":at,"../images/info-circle-blue.svg":rt,"../images/info-circle.svg":ot,"../images/text.svg":it})[`../images/${t}.svg`],import.meta.url).href,className:$(P("image"),{underline:n})}),e.jsx(o,{className:P("text-wrapper"),children:e.jsx(b,{variant:"body",children:i})})]})]})})};O.propTypes={image:r.string,label:r.string,type:r.string,underline:r.bool};const{cx:ne}=E("DraggableSection"),lt=()=>e.jsxs(o,{className:ne("wrapper"),children:[e.jsx(o,{className:ne("text-wrapper"),children:e.jsx(b,{variant:"body",children:p("new_hire.settings.edit_panel.draggable_section.title")})}),e.jsx(O,{image:"edit-pencil",label:p("new_hire.settings.edit_panel.draggable_section.signature"),type:"signature",underline:!1}),e.jsx(O,{image:"calendar",label:p("new_hire.settings.edit_panel.draggable_section.date"),type:"date",underline:!1}),e.jsx(O,{image:"text",label:p("new_hire.settings.edit_panel.draggable_section.text"),type:"text",underline:!0})]}),{cx:Y}=E("ToolTipInfo"),pe=({title:t,toolTipText:i})=>e.jsxs(o,{className:Y("wrapper"),children:[e.jsx(o,{className:Y("title-wrapper"),children:e.jsx(b,{variant:"label",uppercase:!0,children:t})}),e.jsx(o,{className:Y("additional-text"),children:e.jsx(b,{variant:"body",children:i})})]});pe.propTypes={title:r.string,toolTipText:r.string};const{cx:U}=E("EditPanelRadioButton"),K=({employeeRequirementType:t,handleRadioButtonSelect:i,label:s,radioButton:n,toolTipPlacement:l,toolTipText:c})=>{const m=a.useCallback(()=>{i(t)},[i,t]);return e.jsxs(o,{className:U("radio-button-wrapper",t),onClick:m,pointer:!0,row:!0,vcenter:!0,children:[e.jsx(o,{className:U("radio-button"),children:n&&e.jsx(o,{className:"selected-radio-button"})}),e.jsx(b,{className:$(U("radio-button-text"),{selected:n}),variant:"body",children:s}),e.jsx(o,{className:U("tooltip-wrapper"),children:e.jsx(Ze,{trigger:"hover",preferPlace:l,theme:"primary",content:e.jsx(pe,{title:s,toolTipText:c}),children:e.jsx(J,{iconName:"Info",size:"small",color:"primary"})})})]})};K.propTypes={employeeRequirementType:r.string,handleRadioButtonSelect:r.func,label:r.string,radioButton:r.bool,toolTipPlacement:r.string,toolTipText:r.string};const{cx:I}=E("EditPanel"),ae=[z,L],ue=({acknowledgeRadioButton:t,coords:i,employeeCustomDocument:s,file:n,onCreateCustomDocument:l,onUpdateCustomDocument:c,setAcknowledgeRadioButton:m,updateCoordinates:f})=>
1{const _=De(),g=A(),[u,h]=a.useState(""),[d,x]=a.useState(s?.employee_requirement||ae[0]),[v,w]=a.useState(!1),T=sessionStorage.getItem("customDocumentEntry"),D=a.useMemo(()=>{const j=[];return d===L||i.sort((y,W)=>y.pageNumber-W.pageNumber||W.yPts-y.yPts||y.xPts-W.xPts).map(y=>{j.push({page:y.pageNumber,position:[y.xPts,y.yPts],type:y.type})}),j},[i,d]),k=a.useMemo(()=>({fillable_form_fields:D}),[D]),N=a.useCallback(()=>{g(V.BUTTON_CLICKED,H.CLICK,{button_text:"save",document_request_type:d}),_.push(T),sessionStorage.removeItem("customDocumentEntry"),w(!1),F.success(p("new_hire.settings.edit_panel.save_success",{props:{file_name:u}}))},[u,d,_,g,T]);a.useEffect(()=>{h(n===void 0?s.filename:n?.name.replace(".pdf","")),x(s===void 0?ae[0]:s.employee_requirement)},[]);const C=a.useMemo(()=>({file:n,filename:u,employee_requirement:d===L?L:z,required_document:!0,additional_data:JSON.stringify(k)}),[u,d,k,n]),[R,S]=a.useState(!1),q=a.useCallback(()=>S(!1),[]),ve=a.useCallback(()=>S(!0),[]),be=a.useCallback(()=>{w(!0),s?c({id:s.id,params:C}).then(()=>{N()}):l(C).then(se).then(()=>{N()}).catch(()=>{w(!1),F.error(p("new_hire.settings.edit_panel.save_error"))})},[s,l,N,c,C]),ee=oe(),we=a.useCallback(()=>{w(!0),ee(ke({id:s.id})).then(se).then(()=>{window.location.href="/new_hire_onboarding",F.success(p("documents.upload_custom_document.archive_success",{props:{document_name:s.filename}}))}).catch(()=>{w(!1),F.error(p("documents.upload_custom_document.archive_failure"))}),q()},[ee,q,s]),Ce=a.useCallback(j=>{h(j.target.value)},[h]),te=a.useCallback(j=>{const y=j===z?i:[];m(j===L),x(j),f(y)},[i,m,f]);return e.jsxs(o,{className:I("wrapper"),children:[s&&e.jsx(de,{open:R,handleArchive:we,handleClose:q,customDocument:s}),e.jsxs(o,{children:[e.jsx(b,{variant:"heading2",children:p("new_hire.settings.edit_panel.title")}),e.jsx(o,{className:I("name-wrapper"),children:e.jsx(b,{variant:"body",children:p("new_hire.settings.edit_panel.document_title")})}),e.jsxs(o,{className:I("input-field-wrapper"),children:[e.jsx("input",{type:"text","aria-label":p("new_hire.settings.edit_panel.document_title"),className:I("input"),value:u,onChange:Ce}),e.jsx(J,{size:"small",iconName:"Edit"})]}),e.jsxs(o,{className:I("employee-requirement-type-wrapper"),children:[e.jsx(b,{variant:"body",children:p("new_hire.settings.edit_panel.employee_requirement_type_title")}),e.jsxs(o,{className:I("form-wrapper"),children:[e.jsx(K,{employeeRequirementType:z,handleRadioButtonSelect:te,label:p("new_hire.settings.edit_panel.fillable_fields"),radioButton:!t,toolTipPlacement:"above",toolTipText:p("new_hire.settings.edit_panel.fillable_fields_tooltip")}),e.jsx(K,{employeeRequirementType:L,handleRadioButtonSelect:te,label:p("new_hire.settings.edit_panel.acknowledge"),radioButton:t,toolTipPlacement:"below",toolTipText:p("new_hire.settings.edit_panel.acknowledge_tooltip")}),t?e.jsx(tt,{}):e.jsx(lt,{})]})]})]}),e.jsxs(o,{className:I("form-buttons-wrapper"),spacebetween:!0,children:[e.jsx(Z,{variant:"primary",disabled:v,onClick:be,grow:!!s,children:e.jsx(b,{variant:"bodyBold",children:p("new_hire.settings.edit_panel.save")})}),s&&e.jsx(o,{className:I("delete-button-wrapper"),children:e.jsx(Z,{variant:"secondaryDestructive",disabled:v,onClick:ve,children:e.jsx(b,{variant:"bodyBold",children:p("new_hire.settings.edit_panel.delete")})})})]})]})};ue.propTypes={acknowledgeRadioButton:r.bool,coords:r.array,employeeCustomDocument:r.object,file:r.object,onCreateCustomDocument:r.func,onUpdateCustomDocument:r.func,setAcknowledgeRadioButton:r.func,updateCoordinates:r.func};const ct=X(()=>({}),{onCreateCustomDocument:Te,onUpdateCustomDocument:Pe})(ue),{cx:M}=E("Preview"),Q=({dropped:t=!1,removeField:i,type:s,uniqueId:n=null,xPts:l=null,yPts:c=null})=>{const m=a.useCallback(()=>{i?.(n)},[i,n]),{attributes:f,listeners:_,setNodeRef:g,isDragging:u}=le({id:n?`field-${n}`:"preview-overlay",data:{type:s,id:n,panel:!1,xPts:l,yPts:c},disabled:!n});return e.jsxs(o,{ref:g,className:$(M("wrapper"),{draggable:u,dropped:t}),style:{top:c,left:l},...n?f:{},...n?_:{},children:[e.jsx(o,{className:M("dot-wrapper"),children:Array(4).fill().map((h,d)=>e.jsxs(o,{className:M("two-dots-wrapper"),children:[e.jsx(o,{className:M("dot")}),e.jsx(o,{className:M("dot")})]},d))}),e.jsx(o,{className:M("text-wrapper"),children:e.jsx(b,{variant:"captions",color:"brand",capitalize:!0,children:s})}),t&&e.jsx(o,{component:"button",type:"button",className:M("close-wrapper"),pointer:!0,onClick:m,children:e.jsx(b,{variant:"captionBold",color:"inverse",children:"x"})})]})};Q.propTypes={dropped:r.bool,removeField:r.func,type:r.string,uniqueId:r.number,xPts:r.number,yPts:r.number};const me=({field:t,height:i,index:s,removeField:n})=>{const[l,c]=a.useState(i||0);return a.useEffect(()=>
1{const m=document.getElementsByClassName("react-pdf__Page__canvas")[s];c(m.offsetHeight)},[s]),e.jsx(Q,{dropped:!0,removeField:n,type:t.type,uniqueId:t.id,xPts:t.xPts,yPts:l-t.yPts})};me.propTypes={field:r.object,height:r.number,index:r.number,removeField:r.func};const ge=({className:t,coords:i,index:s,page:n,removeField:l})=>{const{setNodeRef:c,isOver:m}=Ie({id:`pdf-page-${s}`,data:{pageIndex:s,pageNumber:n.number}}),{height:f,width:_}=n;return e.jsx(o,{ref:c,style:{height:f,width:_,margin:"15px auto",outline:m?"2px solid #007bff":void 0},children:e.jsx(qe,{className:t,pageNumber:s+1,renderAnnotationLayer:!1,renderTextLayer:!1,children:i.filter(g=>g.pageNumber===s+1).map((g,u)=>e.jsx(me,{index:s,field:g,height:f,removeField:l},u))},`page_${s+1}`)})};ge.propTypes={className:r.string,coords:r.array,index:r.number,page:r.oneOfType([r.object,r.number]),removeField:r.func};Ge.workerSrc=`//unpkg.com/pdfjs-dist@${Ye}/legacy/build/pdf.worker.min.mjs`;const{cx:re}=E("PdfDocument"),fe=({coords:t,employeeCustomDocument:i,file:s,pdfCustomDocumentPageInfo:n,removeField:l})=>{const[c,m]=a.useState(null),[f,_]=a.useState(0);a.useEffect(()=>{m(s===void 0?i.url:URL.createObjectURL(s))},[s,i]);const g=a.useCallback(h=>{_(h._pdfInfo.numPages)},[_]),u=a.useMemo(()=>{const h=[];return[...Array(f).keys()].map(d=>h.push({number:d+1})),h},[f]);return e.jsx(o,{className:re("wrapper"),children:e.jsx(We,{file:c,onLoadSuccess:g,children:(n?.info?.pages||u).map((h,d)=>e.jsx(ge,{className:re("Page"),coords:t,index:d,page:h,removeField:l},d))})})};fe.propTypes={coords:r.array,employeeCustomDocument:r.object,file:r.object,pdfCustomDocumentPageInfo:r.object,removeField:r.func};const{cx:dt}=E("CustomDocumentEditor"),he=({employeeCustomDocument:t,file:i,pdfCustomDocumentPageInfo:s})=>{const[n,l]=a.useState([]),[c,m]=a.useState(t?.employee_requirement===L||!1),f=A();a.useEffect(()=>{const d=t===void 0?"new":"edit";f(V.PAGE_VIEWED,H.VIEW,{add_document_step:"cde",view_document_flow_type:d,document_request_type:t?t.employee_requirement:null})},[t,f]),a.useEffect(()=>{if(t&&!c){const d=[];t?.additional_data?.fillable_form_fields.map(x=>{const v=Math.floor(Math.random()*ie);return d.push({id:v,pageNumber:x.page,type:x.type,xPts:x.position[0],yPts:x.position[1]})}),l(d)}},[c,t]);const _=a.useCallback(d=>{l(x=>[...d])},[l]),g=a.useCallback(d=>{l(x=>[...x,d])},[l]),u=a.useCallback(d=>{const x=n.findIndex(v=>v.id===d);n.splice(x,1),l(v=>[...v])},[n]),{activeDragData:h}=et({coords:n,getCoordinates:g,updateCoordinates:_});return e.jsxs(Se,{className:dt("wrapper"),children:[e.jsx(fe,{coords:n,employeeCustomDocument:t,file:i,pdfCustomDocumentPageInfo:s,removeField:u}),e.jsx(ct,{acknowledgeRadioButton:c,coords:n,employeeCustomDocument:t,file:i,setAcknowledgeRadioButton:m,updateCoordinates:_}),e.jsx(Me,{dropAnimation:null,modifiers:h?.panel?[Je]:[],children:h&&e.jsx(Q,{type:h.type})})]})};he.propTypes={employeeCustomDocument:r.object,file:r.object,pdfCustomDocumentPageInfo:r.object};const{cx:G}=E("UploadedFile"),_e=({file:t,isFetching:i,removeFile:s,setDocumentReady:n,companyId:l,locationId:c})=>{const m=oe(),f=A();a.useEffect(()=>{f(V.PAGE_VIEWED,H.VIEW,{add_document_step:"upload_success"})},[f]);const _=a.useCallback(()=>{m(ce({file:t,companyId:l,locationId:c})).then(()=>{n(!0)})},[m,t,n,l,c]);return e.jsxs(o,{vcenter:!0,column:!0,children:[e.jsxs(o,{className:G("dropped-file-wrapper"),children:[e.jsxs(o,{className:G("file-name-wrapper"),children:[e.jsx(b,{children:t.name}),e.jsx(Ae,{icon:"Delete",onClick:s,size:"small",label:p("actions.delete")})]}),e.jsx(o,{className:G("progress-bar-wrapper")})]}),e.jsx(o,{p:60,tcenter:!0,children:e.jsx(Z,{disabled:i,onClick:_,children:p("new_hire.settings.dropzone.start_editing")})})]})};_e.propTypes={file:r.object,isFetching:r.bool,removeFile:r.func};const pt=X((t,i)=>({isFetching:Be(t),companyId:Re(t),locationId:Le(t,i)}),{onAnalyzeFile:ce})(_e),ut=({cx:t,cxEl:i,onChange:s,setDocumentReady:n,acceptedFileTypes:l=Xe,titleI18n:c="dropzone.drop_file",supportedi18n:m="dropzone.supported_default",theme:f="gray",displayFile:_=!0,setFieldValue:g,setFieldTouched:u})=>
1{const[h,d]=a.useState(null),[x,v]=a.useState(!1),w=A();a.useEffect(()=>{s(h)},[h,s]),a.useEffect(()=>{w(V.PAGE_VIEWED,H.VIEW,{add_document_step:"upload_page"})},[w]);const T=a.useCallback(()=>{d(null),v(!1)},[v,d]),D=a.useCallback(()=>{v(!0)},[v]),k=a.useCallback(()=>{v(!1)},[v]),N=a.useCallback(S=>{S.length!==0&&(g&&g("file",S[0]),u&&u("file",!0),_&&d(S[0]),s(S[0]))},[g,u,_,s]),{getRootProps:C,getInputProps:R}=Ke({onDragEnter:D,onDragLeave:k,onDrop:N,multiple:!1,accept:l});return h?e.jsx(pt,{file:h,removeFile:T,setDocumentReady:n}):e.jsx("div",{...C({className:x?"dropzone-hover":""}),children:e.jsxs(o,{className:t(f),vcenter:!0,hcenter:!0,column:!0,pointer:!0,h:260,p:"md",children:[e.jsx("input",{...R()}),e.jsx(o,{className:t("upload-image-wrapper"),vcenter:!0,hcenter:!0,children:e.jsx(J,{iconName:"Upload",size:"xlarge",color:"brand"})}),e.jsxs(o,{className:t("text-wrapper"),children:[e.jsx(o,{children:e.jsx(b,{className:i("title"),variant:"bodySm",children:p(c)})}),e.jsx(o,{children:e.jsx(b,{variant:"captions",color:"secondary",className:i("subTitle"),children:p(m)})})]})]})})},mt=Ve("DropzoneCustomDocument",ut),{cx:B}=E("UploadCustomDocument"),xe=({employeeCustomDocument:t,isFetching:i,pdfCustomDocumentPageInfo:s})=>{const[n,l]=a.useState(),[c,m]=a.useState(!1),f=a.useMemo(()=>n?"new_hire.settings.dropzone.document_ready":"new_hire.settings.dropzone.uploading_pdf_title",[n]),_=a.useCallback(()=>{Ue.goBack()},[]);return e.jsx(o,{className:B("wrapper"),children:e.jsxs(o,{className:B("document-wrapper"),children:[e.jsx(Z,{variant:"tertiaryPlain",onClick:_,startIcon:"ChevronLeft",children:p("new_hire.settings.custom_document_editor.back")}),c||t?e.jsx(he,{file:n,employeeCustomDocument:t,isFetching:i,pdfCustomDocumentPageInfo:s}):e.jsx(o,{className:B("dropzone-wrapper"),children:e.jsxs(o,{className:B("dropzone-content"),children:[e.jsx(o,{className:B("title-wrapper"),children:e.jsx(b,{variant:"heading2",children:p(f)})}),e.jsx(mt,{acceptedFileTypes:ze,onChange:l,setDocumentReady:m,supportedi18n:"new_hire.settings.upload_custom_document_modal.pdf_supported",titleI18n:"new_hire.settings.dropzone.upload_description",theme:"purple-dashed"})]})})]})})};xe.propTypes={employeeCustomDocument:r.object,pdfCustomDocumentPageInfo:r.object};const yt=X((t,i)=>({pdfCustomDocumentPageInfo:He(t)}),{})(Fe({productArea:$e.TEAM,eventCategory:Oe.NEW_HIRE_ONBOARDING})(xe));export{yt as default};
2//# sourceMappingURL=UploadCustomDocument-chunk-DYo975Kw.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.