forked from Romeo-Rosete/awesome
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
6050-c86256af701067b8.js.download
2 lines (2 loc) · 37.2 KB
/
6050-c86256af701067b8.js.download
1
2
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6050],{56813:function(n,e,r){var t=r(66383),i=r(52903),o=r(2784),a=r(28165),d=r(37168),u=r(42126),c=r(50248),l=r(83766),s=(0,a.iv)('div[data-type="append"]{background-color:inherit !important;font-size:10px !important;font-weight:normal !important;justify-content:flex-end !important;line-height:0 !important;}',"RenameInline.tsx--renameInlineStyle"),f=(0,a.iv)("textarea{font-weight:600 !important;font-size:24px !important;}","RenameInline.tsx--boldStyle");e.Z=function(n){var e=n.boldInput,r=n.loadedText,a=n.onAccept,p=n.onClose,v=n.placeholder,g=(0,o.useState)(r),h=g[0],Z=g[1],m=(0,o.useCallback)((function(){h!==r&&(null===a||void 0===a||a(h)),null===p||void 0===p||p()}),[a,p,h,r]),I=(0,o.useCallback)((function(){return null===p||void 0===p?void 0:p()}),[p]),b=(0,t.Z)((0,d.O)({onClickOutside:I,events:["mousedown","touchstart"]}),1)[0],w=(0,o.useRef)(null);(0,o.useEffect)((function(){var n;null===w||void 0===w||null===(n=w.current)||void 0===n||n.focus()}),[]);var y=(0,o.useRef)(!1);return(0,o.useEffect)((function(){return function(){y.current=!0}}),[]),(0,o.useEffect)((function(){return function(){y.current&&m()}}),[m]),(0,i.tZ)("div",{"data-testid":"rename-inline-input",ref:b,css:[s,e&&f],children:(0,i.tZ)(u.o,{appendContent:(0,i.tZ)(l.Z,{count:null===h||void 0===h?void 0:h.length,limit:255}),onChange:function(n){Z(n.target.value)},onKeyDown:(0,c.q)(["enter","esc"],(function(n){"Enter"===n.key?null===p||void 0===p||p():"Escape"===n.key&&(Z(r),y.current=!1)})),isMultiline:!0,layout:"block",maxLength:255,placeholder:v,ref:w,value:h})})}},49947:function(n,e,r){var t=r(52903),i=r(55414),o=r(26215),a=r(18911);e.Z=function(n){var e=n.description,r=n.note,d=n.onEditorLinkClick,u=n.zapId,c=r&&(null===r||void 0===r?void 0:r.length)>255?"".concat(r.slice(0,255),"..."):r,l=r?"Notes":"Description",s=r?c:e,f=(0,a.Z9)(u);return r||e?(0,t.BX)(i.x,{type:"paragraph3",children:[(0,t.BX)(i.x,{type:"paragraph3Bold",children:[l,": "]}),s," ",(0,t.tZ)(o.r,{onClick:d,href:f,children:"View and edit in the Editor"})]}):null}},5851:function(n,e,r){var t=r(52903),i=r(2784),o=r(66415),a=r(55414),d=r(68516),u=(0,r(28165).iv)("display:flex;flex-direction:column;gap:5px;","ZapDetailTimestamp.tsx--rootStyle");e.Z=function(n){var e=n.canShowDrafts,r=n.createdAt,c=n.displayInline,l=n.hasDraft,s=n.hasPublishedVersion,f=n.isEnabled,p=n.isLoading,v=n.lastDisabledAt,g=n.publishedAt,h=n.updatedAt,Z=(0,i.useMemo)((function(){return e&&l&&!s&&r?{date:r,text:"Created"}:e&&s&&f&&g?{date:g,text:"Published"}:e&&s&&!f&&v?{date:v,text:"Disabled"}:h?{date:h,text:"Last modified"}:null}),[e,r,l,s,f,v,g,h]);return p?(0,t.tZ)(o.N,{lines:1,width:250}):(null===Z||void 0===Z?void 0:Z.date)&&(null===Z||void 0===Z?void 0:Z.text)?(0,t.BX)("div",{css:!c&&u,"data-testid":"zap-detail-timestamp",children:[(0,t.BX)(a.x,{type:"paragraph3Bold",children:[Z.text,!!c&&": "]}),(0,t.BX)(a.x,{type:"paragraph3",children:[(0,t.tZ)(d.ou,{date:Z.date,format:"MMMM DD, YYYY"}),(0,t.tZ)("span",{children:" at "}),(0,t.tZ)(d.ou,{date:Z.date,format:"hh:mm a"})]})]}):null}},97177:function(n,e,r){r.d(e,{Z:function(){return G}});var t=r(70865),i=r(92228),o=r(52903),a=r(2784),d=r(28165),u=r(61854),c=r(87593),l=r(38716),s=r(96670),f=r(39479),p=r(52676),v=r(3e3),g=r(98628),h=r(70776),Z=r(95945),m=r(22211);function I(){var n=(0,i.Z)(["\n ",";\n align-items: stretch;\n border-radius: 20px;\n cursor: pointer;\n display: inline-flex;\n height: 44px;\n min-width: 60px;\n overflow: hidden;\n padding: 6px;\n transition: all "," ease-in-out;\n\n &:focus-within:not(:hover) {\n box-shadow: 0 0 0 2px ",";\n border-color: transparent;\n }\n "]);return I=function(){return n},n}function b(){var n=(0,i.Z)(["\n cursor: not-allowed;\n "]);return b=function(){return n},n}function w(){var n=(0,i.Z)(["\n align-items: center;\n display: flex;\n justify-content: center;\n padding: 9px 0px;\n position: relative;\n vertical-align: middle;\n width: 100%;\n "]);return w=function(){return n},n}function y(){var n=(0,i.Z)(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n z-index: -1;\n "]);return y=function(){return n},n}function k(){var n=(0,i.Z)(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n "]);return k=function(){return n},n}function E(){var n=(0,i.Z)(["\n & div {\n opacity: 1 !important;\n border-color: "," !important;\n border-right-color: transparent !important;\n }\n "]);return E=function(){return n},n}function D(){var n=(0,i.Z)(["\n & div {\n opacity: 1 !important;\n border-color: "," !important;\n border-right-color: transparent !important;\n }\n "]);return D=function(){return n},n}function _(){var n=(0,i.Z)(["\n align-items: center;\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n "]);return _=function(){return n},n}function S(){var n=(0,i.Z)(["\n left: -1px !important;\n color: ",";\n "]);return S=function(){return n},n}function x(){var n=(0,i.Z)(["\n color: ",";\n "]);return x=function(){return n},n}function T(){var n=(0,i.Z)(["\n color: ",";\n "]);return T=function(){return n},n}function z(){var n=(0,i.Z)(["\n color: ",";\n "]);return z=function(){return n},n}function P(){var n=(0,i.Z)(["\n visibility: hidden;\n height: 0;\n "]);return P=function(){return n},n}function C(){var n=(0,i.Z)(["\n display: block;\n border-radius: 100%;\n background-color: ",";\n position: absolute;\n top: 0;\n transition: all "," ease-in-out;\n width: 30px;\n height: 30px;\n "]);return C=function(){return n},n}function A(){var n=(0,i.Z)(["\n left: 0;\n transform: translateX(0);\n background-color: ",";\n "]);return A=function(){return n},n}function N(){var n=(0,i.Z)(["\n border: ",";\n background-color: ",";\n "]);return N=function(){return n},n}function $(){var n=(0,i.Z)(["\n background-color: ",";\n left: 100%;\n transform: translateX(-100%);\n border: ",";\n "]);return $=function(){return n},n}function F(){var n=(0,i.Z)(["\n border: ",";\n "]);return F=function(){return n},n}function O(){var n=(0,i.Z)(["\n height: 100%;\n width: 100%;\n background-color: ",";\n border-radius: 20px;\n "]);return O=function(){return n},n}function B(){var n=(0,i.Z)(["\n background-color: ",";\n "]);return B=function(){return n},n}function L(){var n=(0,i.Z)(["\n background-color: ",";\n "]);return L=function(){return n},n}var R=(0,f.B)("ToggleSwitch",{root:function(n){return[(0,d.iv)(I(),v.ZT.smallPrint1Bold,g.f.transitionDuration,h.w.blue),(n.disabled||n.isLoading||n.indeterminate)&&(0,p.Q)("disabled",(0,d.iv)(b()))]},innerWrap:(0,d.iv)(w()),input:(0,d.iv)(y()),spinner:function(n){return[(0,d.iv)(k()),n.checked&&(0,p.Q)("checked",(0,d.iv)(E(),h.w.success500)),!n.checked&&(0,p.Q)("unchecked",(0,d.iv)(D(),h.w.neutral100))]},text:function(n){return[(0,d.iv)(_()),!n.checked&&(0,p.Q)("unchecked",(0,d.iv)(S(),h.w.neutral100)),n.checked&&(0,p.Q)("checked",(0,d.iv)(x(),h.w.success500)),n.checked&&n.disabled&&(0,p.Q)("checked-disabled",(0,d.iv)(T(),h.w.neutral600)),n.indeterminate&&(0,p.Q)("indeterminate",(0,d.iv)(z(),h.w.earth)),n.isLoading&&(0,p.Q)("loading",(0,d.iv)(P()))]},dot:function(n){return[(0,d.iv)(C(),h.w.neutral700,g.f.transitionDuration),!n.checked&&(0,p.Q)("unchecked",(0,d.iv)(A(),h.w.neutral700)),n.disabled&&!n.checked&&(0,p.Q)("unchecked-disabled",(0,d.iv)(N(),"1px solid ".concat(h.w.neutral100),h.w.neutral600)),n.checked&&(0,p.Q)("checked",(0,d.iv)($(),h.w.neutral100,"1px solid ".concat(h.w.success500))),n.disabled&&n.checked&&(0,p.Q)("checked-disabled",(0,d.iv)(F(),"1px solid ".concat(h.w.neutral600)))]},track:function(n){return[(0,d.iv)(O(),h.w.neutral600),n.checked&&(0,p.Q)("checked",(0,d.iv)(B(),h.w.success500)),n.disabled&&(0,p.Q)("disabled",(0,d.iv)(L(),h.w.neutral600))]}}),U=function(n){return n.ariaLabel?n.ariaLabel:n.isLoading?"Loading":n.indeterminate?"string"===typeof n.indeterminateText?n.indeterminateText:"Indeterminate":n.checked?"On":"Off"},Q=function(n){return n.disabled&&n.showDisabledTooltip?"Disabled":""},X=function(n){return(0,o.tZ)(c.p,{content:Q(n),children:function(e){var r=e.childProps;return(0,o.tZ)("label",(0,s.Z)((0,t.Z)({},(0,Z.v)(r)),{css:R.root(n),children:(0,o.BX)("span",{css:R.innerWrap,children:[(0,o.tZ)("input",{"aria-disabled":n.disabled||n.isLoading||n.indeterminate,"aria-label":U(n),checked:n.checked,css:R.input,disabled:n.disabled||n.isLoading||n.indeterminate,id:n.id,name:n.name,onChange:n.onChange,type:"checkbox",value:n.value}),!n.indeterminate&&(0,o.BX)(a.Fragment,{children:[(0,o.BX)("span",{"aria-hidden":"true",css:R.dot(n),role:"presentation",children:[n.isLoading&&(0,o.tZ)("span",{css:R.spinner(n),children:(0,o.tZ)(m.$,{})}),(0,o.BX)("span",{css:R.text(n),children:[n.checked?"":"Off",n.checked?"On":""]})]}),(0,o.tZ)("span",{className:"track","aria-hidden":"true",css:R.track(n),role:"presentation"})]}),n.indeterminate&&(0,o.tZ)("span",{css:R.text(n),children:n.indeterminateText})]})}))}})};X.defaultProps={indeterminateText:"N/A",isLoading:!1,onChange:function(){},showDisabledTooltip:!0};var M=r(16181),q=r(87744),V=r(90446),j=(String("web_analytics.tracking.user_interaction.ZapEnableToggleEvent"),r(89739));function H(){var n=(0,i.Z)(["\n max-width: 60vw;\n "]);return H=function(){return n},n}function K(){var n=(0,i.Z)(["\n max-width: none;\n "]);return K=function(){return n},n}var J=(0,q.uq)({mobile:(0,d.iv)(H()),tablet:(0,d.iv)(K())}),Y=(0,d.iv)("display:flex;align-items:center;gap:5px;","ZapPauseToggle.tsx--heldTaskStyle"),W=function(){return(0,o.BX)("span",{css:Y,children:[(0,o.tZ)(u.J,{name:"miscHand",size:"14px"}),"Held"]})},G=function(n){var e=n.id,r=n.toggleId,i=void 0===r?"ZapPauseToggle-zap-".concat(e):r,d=n.isHeld,u=void 0!==d&&d,s=n.isLoading,f=void 0!==s&&s,p=n.isRestricted,v=void 0!==p&&p,g=n.isTrashed,h=void 0!==g&&g,Z=n.isValid,m=void 0===Z||Z,I=n.onDisableZap,b=n.onEnableZap,w=n.tooltipPosition,y=void 0===w?"northeast":w,k=n.status,E=void 0===k?"on":k,D=n.isApprovalRequired,_=void 0!==D&&D,S=n.pendingApproval,x=n.userPendingApproval,T=n.setApprovalType,z=(0,l.X8)(),P=(0,M.gn)().userId,C="on"===E,A=(0,a.useMemo)((function(){return v?"Move your Zap to a shared folder so an admin can review your request.":_&&S&&S.requested_by_user_id!==P?"Request pending to ".concat(C?"turn off":"turn on"," this Zap."):_&&x&&!S?"You have a request pending for this Zap.":u?"Zap has held tasks and cannot run.":C?"Zap is on.":h?"Zap is in the trash and cannot be turned on.":m?"Zap is off.":"Zap is incomplete and cannot be turned on."}),[v,_,S,P,x,u,C,h,m]),N=C,$=h||f||v||_&&S&&S.requested_by_user_id!==P||_&&x&&!S||!m&&!C,F={checked:N,disabled:$,indeterminate:u,indeterminateText:u?(0,o.tZ)(W,{}):void 0,onChange:function(){if(!$)if(_&&T)T(C?j.lI.TURN_OFF:j.lI.TURN_ON);else{if(C)return I();!function(n){var e=n.accountId;(0,V.Z)({account_id:e,release_id:"bc2c7338",system_name:"zap-management"},"web_analytics.tracking.user_interaction.ZapEnableToggleEvent")}({accountId:z}),b()}},showDisabledTooltip:!1};return(0,o.tZ)("div",{"data-checked":N,"data-disabled":$,"data-testid":"ZapPauseToggle",id:i,children:(0,o.tZ)(c.p,{allowMultilineTooltip:!0,content:(0,o.tZ)("div",{css:J,children:A}),position:y,tooltipId:"ZapPauseToggle-zap-tooltip-".concat(i),children:function(n){return(0,o.tZ)(X,(0,t.Z)({},n,F))}})})}},9483:function(n,e,r){var t,i,o,a,d,u;r.d(e,{xr:function(){return u}}),function(n){n.filter="filter",n.read="read",n.read_bulk="read_bulk",n.run="run",n.search="search",n.search_or_write="search_or_write",n.write="write"}(t||(t={})),function(n){n.month="month",n.year="year"}(i||(i={})),function(n){n.failure="failure",n.partial="partial",n.processing="processing",n.ready="ready",n.success="success"}(o||(o={})),function(n){n.admin="admin",n.member="member",n.owner="owner",n.super_admin="super_admin"}(a||(a={})),function(n){n.member="member",n.team="team"}(d||(d={})),function(n){n.transfer="transfer",n.workflow="workflow"}(u||(u={}))},52129:function(n,e,r){r.d(e,{k:function(){return d}});var t=r(98788),i=r(5163),o=r(5632),a=r(53736),d=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{isExternal:!1},r=(0,o.useRouter)(),d=(0,a.l)().createNotification;return(0,t.Z)((function(){var t,o;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:r.events.emit("routeChangeStart",[]),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n()];case 2:if(!(t=i.sent()))throw new Error("Route is not defined");return e.isExternal?(window.location.href=t,[3,4]):[2,r.push(t)];case 3:return o=i.sent(),r.events.emit("routeChangeComplete",[]),e.customErrorHandler?e.customErrorHandler(o):d({type:"error",message:"Error navigating to route"}),[3,4];case 4:return[2,Promise.resolve()]}}))}))}},49243:function(n,e,r){var t=r(2784);e.Z=function(n){return(0,t.useMemo)((function(){return n.reduce((function(n,e){var r=e.app;return(null===r||void 0===r?void 0:r.name)&&!n.includes(r.name)&&n.push(r.name),n}),[]).join(", ")}),[n])}},58444:function(n,e,r){r.d(e,{i:function(){return d}});var t=r(52903),i=r(76635),o=r(61854),a=function(n){var e=n.error,r=void 0===e?{}:e;return r.problem&&r.solution?(0,t.BX)("div",{children:[(0,t.tZ)("p",{children:r.problem}),(0,t.BX)("p",{children:[(0,t.tZ)(o.J,{name:"alertInfo",size:14})," ",r.solution]})]}):(0,t.tZ)("p",{children:"Error creating or retrieving shared zap"})},d=function(n){var e=function(n){return"".concat(n.problem,"___").concat(n.solution)};return function(r){(null===r||void 0===r?void 0:r.length)?(0,i.uniqBy)(r,e).forEach((function(e){return n(function(n){return(0,t.tZ)(a,{error:n})}(e))})):n((function(){return(0,t.tZ)(a,{})}))}}},13961:function(n,e,r){var t=r(81455),i=r(76635);e.Z=function(n){if(!(0,i.isEmpty)(n))try{return(0,t.M8)(n,n.zdl_version),!0}catch(e){return!1}return!1}},57441:function(n,e,r){var t=r(40794),i=r(13961),o=r(40182),a=r(35591);e.Z=function(n){var e,r=n.zapId,d=!r,u=(0,t.a)(o.Z,{skip:d,onError:function(n){(0,a.Z)("Zap",n)},variables:{zapId:r}}),c=u.data;return{isLoading:u.loading,isValidZdl:(0,i.Z)((null===c||void 0===c||null===(e=c.zapById)||void 0===e?void 0:e.zdl)||{}),zap:null===c||void 0===c?void 0:c.zapById}}},40182:function(n,e,r){var t=r(92228),i=r(60138);function o(){var n=(0,t.Z)(["\n fragment ZapOwner on Member {\n email\n id\n imageUrl\n name\n }\n"]);return o=function(){return n},n}function a(){var n=(0,t.Z)(["\n fragment ShareOwner on ShareMember {\n email\n id\n imageUrl\n name\n }\n"]);return a=function(){return n},n}function d(){var n=(0,t.Z)(["\n ","\n fragment ZapFolder on Folder {\n id\n isShared\n owner {\n ...ShareOwner\n }\n ownerId\n title\n }\n"]);return d=function(){return n},n}function u(){var n=(0,t.Z)(["\n fragment ZapAuthentications on Authentication {\n created\n description\n id\n images {\n url32X32\n }\n isPrivate\n isShared\n isStale\n serviceSlug\n selectedApi\n sharedWithAll\n title\n }\n"]);return u=function(){return n},n}function c(){var n=(0,t.Z)(["\n ","\n ","\n ","\n\n fragment SingleZap on Zap {\n account {\n id\n normalizedImageUrl\n normalizedName\n periodEndDate\n periodStartDate\n }\n authentications {\n ...ZapAuthentications\n }\n createdAt\n description\n folderId\n folder {\n ...ZapFolder\n }\n hasDraft\n currentVersionId\n hasPublishedVersion\n heldTasks {\n total\n }\n id\n isEnabled\n isInstant\n isShared\n isTrashed\n kind\n lastDisabledAt\n note\n owner {\n ...ZapOwner\n }\n publishedAt\n sourceUrl\n steps {\n app {\n actions {\n bulkReads {\n key\n }\n }\n name\n id\n images {\n url32X32\n }\n }\n id\n }\n timezone\n title\n triggerSupportsTransfer\n updatedAt\n zdl\n }\n"]);return c=function(){return n},n}function l(){var n=(0,t.Z)(["\n ","\n query Zap($zapId: ID!) {\n zapById(id: $zapId) {\n ...SingleZap\n }\n }\n"]);return l=function(){return n},n}var s=(0,i.Ps)(o()),f=(0,i.Ps)(a()),p=(0,i.Ps)(d(),f),v=(0,i.Ps)(u()),g=(0,i.Ps)(c(),p,v,s),h=(0,i.Ps)(l(),g);e.Z=h},12700:function(n,e,r){var t=r(76635),i=r(38716),o=r(68217),a=r(52008),d=r(9466),u=r(91815),c=r(16181),l=r(39386),s=r(38153);e.Z=function(n){var e,r=n.isSearching,f=void 0!==r&&r,p=n.zap,v=n.currentFolderId,g=n.rootFolderId,h=p||{},Z=h.isEnabled,m=void 0!==Z&&Z,I=h.isTrashed,b=void 0!==I&&I,w=h.isInstant,y=h.sourceUrl,k=void 0===y?"":y,E=(0,a.Z)(v),D=(0,l.Z)({folderId:Number(g)}),_=(0,l.Z)({folderId:E}),S=(0,c.gn)(),x=S.allowImportExport,T=S.userId,z=S.roles,P=(0,i.X8)(),C=(0,o.Z)({accountId:P}).foldersTree,A=(0,t.get)(p,"triggerSupportsTransfer",!1)&&!(0,d.Z)(E)&&!b,N=Boolean(String(null===p||void 0===p||null===(e=p.owner)||void 0===e?void 0:e.id)===String(T)),$=!!(null===z||void 0===z?void 0:z.some((function(n){return String(null===n||void 0===n?void 0:n.accountId)===String(P)&&("owner"===n.role||"super_admin"===n.role)}))),F=!(0,d.Z)(E)&&(0,s.rU)(p,C,T)&&((0,s.KZ)(p,T,null===D||void 0===D?void 0:D.isShared,null===_||void 0===_?void 0:_.isShared)||(0,u.Z)(E))||b||$,O=!b,B=!1===w&&m,L=!b,R=!(0,d.Z)(E)&&!b,U=!b&&!(0,d.Z)(E),Q=!(0,d.Z)(E)&&!b,X=!b,M=x&&!b&&N,q=(null===k||void 0===k?void 0:k.includes("app.slack.com"))&&k||void 0,V=function(){var n,e=Boolean((null===_||void 0===_?void 0:_.isShared)||(null===D||void 0===D?void 0:D.isShared)),r=Boolean(null===(n=null===z||void 0===z?void 0:z.filter((function(n){return String(null===n||void 0===n?void 0:n.accountId)===String(P)})))||void 0===n?void 0:n.some((function(n){return"owner"===n.role||"admin"===n.role||"super_admin"===n.role})));return e&&(r||N)}();return{canChangeOwner:V,canCheck:X,canDelete:Q,canDuplicate:U,canEdit:O,canExport:M,canMoveZap:F,canRename:L,canRun:B,canShare:R,canShowDrafts:!(0,d.Z)(E)&&!f,canTransferExistingData:A,slackWorkflowBuilderUrl:q}}},38153:function(n,e,r){r.d(e,{rU:function(){return u},no:function(){return l},V7:function(){return d},KZ:function(){return c}});var t=r(76635),i=r(73223),o=i.Ru.filter((function(n){return n!==i.ZJ&&n!==i.K0})),a=function(n){return!(0,t.isUndefined)(n)&&o.includes(Number(n))},d=function(n,e){var r;return String(null===n||void 0===n||null===(r=n.owner)||void 0===r?void 0:r.id)===String(e)},u=function(n,e,r){return e.filter((function(e){return function(n,e){return e.isShared||n}(d(n,r),e)&&!a(e.id)})).length>1},c=function(n,e,r,t){return d(n,e)||!!r||!!t},l=function(n,e,r){return(!(null===n||void 0===n?void 0:n.every((function(n){return n.isTrashed})))||"-1"!==String(null===e||void 0===e?void 0:e.folderId))&&((e.folderShared||!e.folderShared&&(null===n||void 0===n?void 0:n.every((function(n){return d(n,r)}))))&&!a(null===e||void 0===e?void 0:e.folderId)&&((null===n||void 0===n?void 0:n.every((function(n){return n.isTrashed})))||(null===n||void 0===n?void 0:n.every((function(n){return String(n.folderId)!==String(null===e||void 0===e?void 0:e.folderId)})))))}},28800:function(n,e,r){r.d(e,{Z:function(){return U}});var t=r(98788),i=r(70865),o=r(66383),a=r(5163),d=r(52903),u=r(2784),c=r(33379),l=r(3842),s=r(26215),f=r(92228),p=r(60138),v=r(53770);function g(){var n=(0,f.Z)(["\n mutation DeleteZap($accountId: ID!, $id: ID!) {\n deleteZap(accountId: $accountId, id: $id)\n }\n"]);return g=function(){return n},n}function h(){var n=(0,f.Z)(["\n mutation DisableZap($accountId: ID!, $id: ID!) {\n disableZap(accountId: $accountId, id: $id) {\n id\n isEnabled\n lastDisabledAt\n updatedAt\n }\n }\n"]);return h=function(){return n},n}function Z(){var n=(0,f.Z)(["\n ","\n\n mutation LegacyDuplicateZap($id: ID!) {\n legacyDuplicateZap(id: $id) {\n ...Zap\n folder {\n id\n ownerId\n }\n }\n }\n"]);return Z=function(){return n},n}function m(){var n=(0,f.Z)(["\n mutation EnableZap($accountId: ID!, $id: ID!, $currentVersionId: ID) {\n enableZap(\n accountId: $accountId\n id: $id\n currentVersionId: $currentVersionId\n ) {\n id\n isEnabled\n publishedAt\n updatedAt\n }\n }\n"]);return m=function(){return n},n}function I(){var n=(0,f.Z)(["\n query ExportZap($accountId: Int!, $ids: [Int!]!) {\n account(id: $accountId) {\n id\n zapExport(zapIds: $ids)\n }\n }\n"]);return I=function(){return n},n}function b(){var n=(0,f.Z)(["\n mutation MoveZapFolder($id: ID!, $folderId: ID!, $accountId: ID!) {\n moveZapFolder(id: $id, folderId: $folderId, accountId: $accountId) {\n folderId\n id\n isTrashed\n }\n }\n"]);return b=function(){return n},n}function w(){var n=(0,f.Z)(["\n mutation SetZapTitle($accountId: ID!, $id: ID!, $title: String!) {\n setZapTitle(accountId: $accountId, id: $id, title: $title) {\n id\n title\n updatedAt\n }\n }\n"]);return w=function(){return n},n}function y(){var n=(0,f.Z)(["\n mutation TransferZapOwner($id: ID!, $ownerId: ID!, $accountId: ID!) {\n changeZapOwner(id: $id, ownerId: $ownerId, accountId: $accountId) {\n id\n owner {\n id\n imageUrl\n email\n name\n }\n }\n }\n"]);return y=function(){return n},n}var k=(0,p.Ps)(g()),E=(0,p.Ps)(h()),D=(0,p.Ps)(Z(),v.Z),_=(0,p.Ps)(m()),S=(0,p.Ps)(I()),x=(0,p.Ps)(b()),T=(0,p.Ps)(w()),z=(0,p.Ps)(y()),P=r(73041),C=r(73223),A=r(40182),N=function(n){var e=n.zapId;return{query:A.Z,variables:{zapId:e}}},$=r(86692),F=r(8594),O=r(9483),B=r(53736),L=r(16181),R=r(35591);var U=function(n){var e=n.accountId,r=n.folderId,f=void 0===r?C.ZJ:r,p=n.kind,v=void 0===p?O.xr.workflow:p,g=n.searchQuery,h=n.zapId,Z=void 0===h?null:h,m=n.currentVersionId,I=void 0===m?null:m,b=n.ownerId,w=n.page,y=(0,B.l)().createNotification,A=(0,L.gn)().userId,U=(0,o.Z)((0,c.D)(k,{onError:function(n){(0,R.Z)("DeleteZapMutation",n),y({message:"Error deleting Zap: ".concat((0,$.e$)(n)),type:"error"})},refetchQueries:function(){return g?[(0,P.O_)({searchQuery:g,page:w}),N({zapId:Z})]:[N({zapId:Z})]},update:function(n){Z&&!g&&void 0!==b&&((0,P.c0)(n,(0,i.Z)({accountId:e,folderId:f,zapIds:[Z],ownerId:b,userId:A},w?{offset:w*C.wN}:{})),(0,P.a0)(n,{accountId:e}))}}),1)[0],Q=(0,o.Z)((0,c.D)(E,{onError:function(n){(0,R.Z)("DisableZap",n),y({message:"Error turning Zap off: ".concat((0,$.e$)(n)),type:"error"})},update:function(n,e){var r=e.data;g&&(0,P.jj)(n,{zapId:Z},{isEnabled:null===r||void 0===r?void 0:r.disableZap.isEnabled})}}),2),X=Q[0],M=Q[1],q=(0,o.Z)((0,c.D)(_,{onError:function(n){var e="Error turning Zap on: ".concat((0,$.e$)(n));(0,R.Z)("EnableZap",n),y({message:e,type:"error"})},update:function(n,e){var r=e.data;g&&(0,P.jj)(n,{zapId:Z},{isEnabled:null===r||void 0===r?void 0:r.enableZap.isEnabled})}}),2),V=q[0],j=q[1],H=(0,o.Z)((0,c.D)(D,{onError:function(n){var e="Error duplicating Zap: ".concat((0,$.e$)(n));(0,R.Z)("DuplicateZap",n),y({message:e,type:"error"})},refetchQueries:function(){return g?[(0,P.O_)({searchQuery:g,page:w})]:[]},update:function(n,e){var r=e.data;if(!g){var t=(null===r||void 0===r?void 0:r.legacyDuplicateZap)||{},i=t.owner.id;(0,P.U)(n,t,{kind:v,ownerId:i,originalZapId:Z,userId:A})}}}),2),K=H[0],J=H[1],Y=(0,o.Z)((0,l.t)(S,{fetchPolicy:"no-cache",onCompleted:function(n){var e=n.account.zapExport,r=(new Date).toISOString();(0,F.S)("exported-zap-".concat(r,".json"),JSON.stringify(e))},onError:function(n){y({message:"Error exporting Zap: ".concat((0,$.e$)(n)),type:"error"})}}),2),W=Y[0],G=Y[1],nn=(0,o.Z)((0,c.D)(x,{onError:function(n){(0,R.Z)("MoveZapFolder",n)},refetchQueries:function(){return g?[(0,P.O_)({folderId:f,searchQuery:g,page:w})]:[]},update:function(n,r){var t=r.data;if(Z){var i,o=Number((null===t||void 0===t||null===(i=t.moveZapFolder)||void 0===i?void 0:i.folderId)||C.ZJ);!g&&b&&(0,P.Bs)(n,{accountId:e,folderId:f,ownerId:b,zapIds:[Z],userId:A,newFolderId:o}),f===C.K0&&b&&(0,P.P1)(n,{ownerId:b,folderId:o,userId:A})}}}),1),en=nn[0],rn=(0,o.Z)((0,c.D)(T,{onError:function(n){(0,R.Z)("SetZapTitle",n),y({message:"Error renaming Zap: ".concat((0,$.e$)(n)),type:"error"})},refetchQueries:function(){return g?[(0,P.O_)({searchQuery:g,page:w})]:[]}}),2),tn=rn[0],on=rn[1],an=(0,o.Z)((0,c.D)(z,{onCompleted:function(n){y({message:"This Zap is now owned by ".concat(n.changeZapOwner.owner.name),type:"success"})},onError:function(n){(0,R.Z)("ChangeZapOwner",n),y({message:"Error changing Zap owner: ".concat((0,$.e$)(n)),type:"error"})}}),2),dn=an[0],un=an[1],cn=(0,u.useCallback)((function(){W({variables:{accountId:e,ids:[Number(Z)]}})}),[e,W,Z]),ln=(0,u.useCallback)(function(){var n=(0,t.Z)((function(n){var r,t;return(0,a.__generator)(this,(function(i){switch(i.label){case 0:return r=n.targetFolderId,t=n.zapId,[4,en({variables:{accountId:e,folderId:r,id:t},optimisticResponse:{moveZapFolder:{__typename:"Zap",id:t,folderId:r,isTrashed:String(r)===String(C.K0)}}})];case 1:return[2,i.sent()]}}))}));return function(e){return n.apply(this,arguments)}}(),[e,en]),sn=(0,u.useCallback)(function(){var n=(0,t.Z)((function(n){var e,r,t,i,o,c,l;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:e=n.originalTargetFolderId,r=n.originalTargetFolderName,t=n.zap,i=t.folderId,o=function(){y({message:(0,d.BX)(u.Fragment,{children:["Zap that was moved into the"," ",(0,d.tZ)(s.r,{href:"/app/zaps/folder/".concat(e),children:r})," ","folder could not be undone. Please try again!"]}),type:"error"})},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,ln({targetFolderId:i,zapId:t.id})];case 2:return(null===(l=a.sent())||void 0===l||null===(c=l.data)||void 0===c?void 0:c.moveZapFolder)?y({message:(0,d.BX)(u.Fragment,{children:["Zap that was moved into the"," ",(0,d.tZ)(s.r,{href:"/app/zaps/folder/".concat(e),children:r})," ","folder has been undone."]}),type:"success"}):o(),[2,l];case 3:return a.sent(),o(),[3,4];case 4:return[2]}}))}));return function(e){return n.apply(this,arguments)}}(),[y,ln]),fn=(0,u.useCallback)(function(){var n=(0,t.Z)((function(n){var e,r,t,i,o,c,l;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:e=n.folderName,r=n.targetFolderId,t=n.zap,i='"'.concat(e,'"'),o=function(){y({message:(0,d.BX)(u.Fragment,{children:["Zap could not be moved into the"," ",(0,d.tZ)(s.r,{href:"/app/zaps/folder/".concat(r),children:i})," ","folder. Please try again!"]}),type:"error"})},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,ln({zapId:Z,targetFolderId:r})];case 2:return(null===(l=a.sent())||void 0===l||null===(c=l.data)||void 0===c?void 0:c.moveZapFolder)?y({message:(0,d.BX)(u.Fragment,{children:["Zap was moved into the"," ",(0,d.tZ)(s.r,{href:"/app/zaps/folder/".concat(r),children:i})," ","folder."," ",t&&!t.isTrashed&&(0,d.tZ)(s.r,{onClick:function(){return sn({zap:t,originalTargetFolderId:r,originalTargetFolderName:i})},children:"Undo"})]}),type:"success"}):(null===l||void 0===l?void 0:l.errors)&&o(),[2,l];case 3:return a.sent(),o(),[3,4];case 4:return[2]}}))}));return function(e){return n.apply(this,arguments)}}(),[Z,y,sn,ln]),pn=(0,u.useCallback)((function(){return X({optimisticResponse:{disableZap:{__typename:"Zap",id:Z||"",isEnabled:!1,lastDisabledAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()}},variables:{accountId:e,id:Z}})}),[e,X,Z]),vn=(0,u.useCallback)((0,t.Z)((function(){var n,e;return(0,a.__generator)(this,(function(r){switch(r.label){case 0:return[4,K({variables:{id:Z}})];case 1:return e=r.sent(),[2,null===(n=e.data)||void 0===n?void 0:n.legacyDuplicateZap]}}))})),[K,Z]),gn=(0,u.useCallback)((function(){return V({optimisticResponse:{enableZap:{__typename:"Zap",id:Z||"",isEnabled:!0,publishedAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()}},variables:{accountId:e,id:Z,currentVersionId:I}})}),[e,V,Z,I]),hn=(0,u.useCallback)((function(n){tn({optimisticResponse:{setZapTitle:{__typename:"Zap",id:Z||"",title:n,updatedAt:(new Date).toISOString()}},variables:{accountId:e,id:Z,title:n}})}),[e,Z,tn]),Zn=(0,u.useCallback)((function(n){dn({variables:{accountId:e,id:Z,ownerId:n}})}),[dn,Z,e]),mn=(0,u.useCallback)(function(){var n=(0,t.Z)((function(n){var r,t,i,o;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:r=n.zap,t=function(){y({message:(0,d.tZ)(u.Fragment,{children:"Zap could not be deleted. Please try again!"}),type:"error"})},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,U({variables:{accountId:e,id:Z},optimisticResponse:{deleteZap:Z}})];case 2:return(null===(o=a.sent())||void 0===o||null===(i=o.data)||void 0===i?void 0:i.deleteZap)?y({message:(0,d.BX)(u.Fragment,{children:["Zap has been moved into the"," ",(0,d.tZ)(s.r,{href:"/app/zaps/folder/-1",children:"Trash"})," folder."," ",r&&(0,d.tZ)(s.r,{onClick:function(){return sn({originalTargetFolderId:"-1",originalTargetFolderName:"Trash",zap:r})},children:"Undo"})]}),type:"success"}):(null===o||void 0===o?void 0:o.errors)&&t(),[2,o];case 3:return a.sent(),t(),[3,4];case 4:return[2]}}))}));return function(e){return n.apply(this,arguments)}}(),[e,U,Z,y,sn]);return{isPausing:M.loading||j.loading,isWorking:J.loading||G.loading||on.loading||un.loading,moveZapToTrash:mn,onChangeZapOwner:Zn,onDisableZap:pn,onDuplicateZap:vn,onEnableZap:gn,onExportZap:cn,onMoveZapFolder:fn,onSetZapTitle:hn}}},73041:function(n,e,r){r.d(e,{Bs:function(){return Z},O_:function(){return b},P1:function(){return m},U:function(){return g},a0:function(){return I},c0:function(){return h},jj:function(){return v}});var t=r(70865),i=r(96670),o=r(50930),a=r(76635),d=r(87786),u=r(73223),c=r(9483),l=r(87063),s=r(50668),f=function(n,e){var r=e.folderId,o=e.ownerId,a=e.kind,d=void 0===a?c.xr.workflow:a;return n.readQuery({query:s.PB,variables:(0,i.Z)((0,t.Z)({},o?{ownerId:o}:{}),{folderId:Number(r),kind:d})})},p=function(n,e){var r=e.accountId,i=e.folderId,o=e.offset;return n.readQuery({query:d._n,variables:(0,t.Z)({accountId:r,limit:u.wN,folderId:Number(i)},o?{offset:o}:{})})},v=function(n,e,r){var i=e.zapId;return n.updateFragment({id:"LegacyZap:".concat(i),fragment:l.hw},(function(n){return(0,t.Z)({},n,r)}))},g=function(n,e,r){var d=r.kind,c=r.originalZapId,l=r.ownerId,s=r.userId,p=e.folderId||u.ZJ,v=f(n,{folderId:p,kind:d,ownerId:l!==s?l:void 0});if(v){var g=(0,a.indexOf)(v.zaps.edges,(0,a.find)(v.zaps.edges,(function(n){return String(n.id)===String(c)}))),h=-1===g?0:g,Z=(0,o.Z)(v.zaps.edges.slice(0,h)).concat([e],(0,o.Z)(v.zaps.edges.slice(h)));n.modify({fields:{zaps:function(n,e){return e.storeFieldName.includes(":".concat(p))?(0,i.Z)((0,t.Z)({},v.zaps),{edges:Z,pageInfo:(0,i.Z)((0,t.Z)({},v.zaps.pageInfo),{total:v.zaps.pageInfo+1}),totalCount:v.zaps.totalCount+1}):n}},id:n.identify((0,t.Z)({__typename:"Query"},v))})}},h=function(n,e){var r=e.accountId,o=e.folderId,a=e.ownerId,d=e.zapIds,u=e.userId,c=f(n,{folderId:o,ownerId:a&&a!==u?a:void 0}),l=p(n,{accountId:r,folderId:o});if(c){var s=null===c||void 0===c?void 0:c.zaps,v=((null===s||void 0===s?void 0:s.edges)||[]).filter((function(n){var e=n.id;return!d.includes(e)})),g=(null===s||void 0===s?void 0:s.edges.length)-v.length;n.modify({fields:{zaps:function(n,e){return e.storeFieldName.includes(":".concat(o))?(0,i.Z)((0,t.Z)({},s),{edges:v.map((function(n){return{__ref:"Zap:".concat(n.id)}})),pageInfo:(0,i.Z)((0,t.Z)({},s.pageInfo),{count:(null===s||void 0===s?void 0:s.pageInfo.count)-g}),orgPageInfo:(0,i.Z)((0,t.Z)({},s.orgPageInfo),{count:s.orgPageInfo.count-g}),totalCount:(null===s||void 0===s?void 0:s.totalCount)-g}):n}},optimistic:!0})}if(l){var h=l.legacyZaps,Z=((null===h||void 0===h?void 0:h.edges)||[]).filter((function(n){var e=n.id;return!d.includes(e)}));n.modify({fields:{legacyZaps:function(){return(0,i.Z)((0,t.Z)({},h),{edges:Z})}},optimistic:!0})}},Z=function(n,e){var r=e.accountId,a=e.folderId,d=e.ownerId,u=e.zapIds,c=e.userId,l=e.newFolderId,s=f(n,{folderId:a,ownerId:d&&d!==c?d:void 0}),v=p(n,{accountId:r,folderId:a});if(s){var g=null===s||void 0===s?void 0:s.zaps;n.modify({fields:{zaps:function(n,e){var r=e.storeFieldName;if(r.includes(":".concat(l))){var d=((null===g||void 0===g?void 0:g.edges)||[]).filter((function(n){var e=n.folderId;return String(e)===String(l)})).map((function(n){return n.id})),c=(0,o.Z)(new Set((0,o.Z)(d).concat((0,o.Z)(u)))).map((function(n){return{__ref:"Zap:".concat(n)}}));return(0,i.Z)((0,t.Z)({},g),{edges:c,pageInfo:(0,i.Z)((0,t.Z)({},g.pageInfo),{count:g.pageInfo.count+u.length}),orgPageInfo:(0,i.Z)((0,t.Z)({},g.orgPageInfo),{count:g.orgPageInfo.count+u.length}),totalCount:(null===g||void 0===g?void 0:g.totalCount)+u.length})}if(r.includes(":".concat(a))){var s=((null===g||void 0===g?void 0:g.edges)||[]).filter((function(n){var e=n.id;return!u.includes(e)})),f=(null===g||void 0===g?void 0:g.edges.length)-s.length;return(0,i.Z)((0,t.Z)({},g),{edges:s.map((function(n){return{__ref:"Zap:".concat(n.id)}})),pageInfo:(0,i.Z)((0,t.Z)({},g.pageInfo),{count:(null===g||void 0===g?void 0:g.pageInfo.count)-f}),orgPageInfo:(0,i.Z)((0,t.Z)({},g.orgPageInfo),{count:g.orgPageInfo.count-f}),totalCount:(null===g||void 0===g?void 0:g.totalCount)-f})}var p=((null===n||void 0===n?void 0:n.edges)||[]).filter((function(n){var e=n.__ref,r=e.substring(e.lastIndexOf(":")+1);return!u.includes(r)}));return(0,i.Z)((0,t.Z)({},n),{edges:p})}},optimistic:!0})}if(v){var h=v.legacyZaps,Z=((null===h||void 0===h?void 0:h.edges)||[]).filter((function(n){var e=n.id;return!u.includes(e)}));n.modify({fields:{legacyZaps:function(){return(0,i.Z)((0,t.Z)({},h),{edges:Z})}},optimistic:!0})}},m=function(n,e){var r=e.folderId,t=e.ownerId,i=e.userId;f(n,{folderId:r,ownerId:t!==i?t:void 0})&&n.modify({fields:{zaps:function(n,e){var t=e.DELETE;return e.storeFieldName.includes(":".concat(r))?t:n}},optimistic:!0})},I=function(n,e){var r=e.accountId;p(n,{accountId:r,folderId:u.K0})&&n.modify({fields:{legacyZaps:function(n,e){var r=e.DELETE;return e.storeFieldName.includes(":".concat(u.K0))?r:n}},optimistic:!0})},b=function(n){var e=n.folderId,r=n.searchQuery,i=n.page;return{query:d.oN,variables:(0,t.Z)({},e?{folderId:e}:{},r?{search:r}:{},i&&i>1?{offset:(i-1)*u.wN}:{})}}},53770:function(n,e,r){var t=r(92228);function i(){var n=(0,t.Z)(["\n fragment Zap on Zap {\n accountId\n authentications {\n description\n id\n isPrivate\n isShared\n isStale\n serviceSlug\n selectedApi\n sharedWithAll\n title\n }\n createdAt\n description\n folderId\n hasDraft\n currentVersionId\n hasPublishedVersion\n heldTasks {\n total\n }\n id\n isEnabled\n isInstant\n isShared\n isTrashed\n kind\n lastDisabledAt\n note\n owner {\n email\n id\n imageUrl\n name\n }\n publishedAt\n sourceUrl\n steps {\n app {\n actions {\n bulkReads {\n key\n }\n }\n images {\n url32X32\n }\n name\n id\n }\n id\n }\n title\n triggerSupportsTransfer\n updatedAt\n zdl\n }\n"]);return i=function(){return n},n}var o=(0,r(60138).Ps)(i());e.Z=o},89739:function(n,e,r){var t,i,o,a,d,u,c,l,s,f,p;r.d(e,{lI:function(){return a}}),function(n){n.filter="filter",n.read="read",n.read_bulk="read_bulk",n.run="run",n.search="search",n.search_or_write="search_or_write",n.write="write"}(t||(t={})),function(n){n.ACTIONADDED="ACTIONADDED",n.ALPHABETICAL="ALPHABETICAL",n.CREATED="CREATED",n.POPULARITY="POPULARITY",n.RECENT="RECENT"}(i||(i={})),function(n){n.APPROVED="APPROVED",n.CANCELLED="CANCELLED",n.DENIED="DENIED",n.PENDING="PENDING"}(o||(o={})),function(n){n.DELETE="DELETE",n.PUBLISH="PUBLISH",n.TURN_OFF="TURN_OFF",n.TURN_ON="TURN_ON"}(a||(a={})),function(n){n.month="month",n.year="year"}(d||(d={})),function(n){n.failure="failure",n.partial="partial",n.processing="processing",n.ready="ready",n.success="success"}(u||(u={})),function(n){n.admin="admin",n.member="member",n.owner="owner",n.super_admin="super_admin"}(c||(c={})),function(n){n.bank="bank",n.card="card",n.manual="manual",n.paypal="paypal"}(l||(l={})),function(n){n.member="member",n.team="team"}(s||(s={})),function(n){n.asc="asc",n.desc="desc"}(f||(f={})),function(n){n.transfer="transfer",n.workflow="workflow"}(p||(p={}))},36911:function(n,e,r){var t;r.d(e,{I:function(){return t}}),function(n){n.changeOwner="changeOwner",n.export="export",n.move="move",n.none="none",n.run="run",n.share="share",n.trash="trash",n.rename="rename",n.duplicate="duplicate",n.moveToSharedFolderConfirmation="moveToSharedFolderConfirmation"}(t||(t={}))},50248:function(n,e,r){r.d(e,{q:function(){return d}});var t=r(76635),i=r(29620),o=r.n(i),a=function(n){return Array.isArray(n)?n:[n]},d=function(n,e){return function(r){var i=a(n);(0,t.some)(i,(function(n){return r.keyCode===Number(o()(n))}))&&e(r)}}},8594:function(n,e,r){r.d(e,{S:function(){return t}});var t=function(n,e){var r=document.createElement("a"),t=new File([e],n,{type:"application/json"}),i=URL.createObjectURL(t);r.setAttribute("href",i),r.setAttribute("download",n),r.style.display="none",null!==document.body&&document.body.appendChild(r),r.click(),null!==document.body&&document.body.removeChild(r)}},91815:function(n,e,r){var t=r(73223);e.Z=function(n){return n===t.K0}},47886:function(n,e,r){r.d(e,{G:function(){return t}});var t=function(n){if(!n)return"";var e=n.indexOf(" ");return-1!==e?"".concat(n.substring(0,e+2),"."):n}}}]);
//# sourceMappingURL=6050-c86256af701067b8.js.map