forked from bombastictranz/awesome
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
310-0d801ab9f9ecf6c6.js.download
1 lines (1 loc) · 12.8 KB
/
310-0d801ab9f9ecf6c6.js.download
1
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{31783:function(e,t,n){n.d(t,{A:function(){return ServiceIcon}});var r=n(95235),a=n(2784),o=n(35788),c=n(37365),s=n(52903);function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var ServiceIcon=function(e){var t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){(0,r.Z)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({ariaHidden:!1,borderColor:"gray20",borderWidth:1},e),n=t.borderColor,l=t.borderWidth,i=t.serviceName,u=t.size,d=t.shadow,p=(0,a.useState)(!1),f=p[0],y=p[1],v=Math.ceil(.7*u),g=(i||"").split("@")[0];return(0,s.tZ)(o.e,{borderColor:n,borderWidth:l,isInGroup:e.isInGroup,shadow:d,size:u,children:f?(0,s.tZ)("div",{className:"PlaceholderAPI64x64 ".concat(g,"64x64 app-logo img64 zap-icons__icon"),style:{height:v,width:v}}):(0,s.tZ)(c.E,{alt:t.alt||t.src||"",borderRadius:0,height:v,onError:function(){return y(!0)},src:t.src||"https://zapier.com/generated/".concat(g,"/64"),width:v})})}},93273:function(e,t,n){n.d(t,{MN:function(){return useMassAction}});var r,a,o,c,s,l,i=n(82269),u=n(95235),d=n(20406),p=n(81333),f=n(7328),y=n(28526),v=n.n(y),g=n(60138),b=n(33379),h=n(40794),O=n(2784),_=n(38716),w=n(53861),m=n(45455),j=n.n(m),k=n(57370),I=n.n(k),R=n(19928),P=n.n(R),Z=n(61390);(r=a||(a={})).access_blacklisted_app="access_blacklisted_app",r.deleted_zap="deleted_zap",r.diverged_zap="diverged_zap",r.expired_task="expired_task",r.outstanding_task="outstanding_task",r.paused_zap="paused_zap",r.plan_limit="plan_limit",r.playing_task="playing_task",r.stale_auth="stale_auth",r.successful_task="successful_task",r.unsuccessful_task="unsuccessful_task";var x=["success"],D=["deleted"];function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var E={mass_replay_down:{href:"https://status.zapier.com",text:"Zapier Status"},plan_limit:{href:"/app/billing/plans",text:"Upgrade Now"},payment_issue:{href:"/app/settings/billing",text:"Update Card"}},A={plan_limit:{href:"/app/settings/billing",text:"Upgrade Now"},stale_auth:{href:"/app/connections",text:"Reconnect your account to try again."}},M=["zapId"];function useMassAction_ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function useMassAction_objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?useMassAction_ownKeys(Object(n),!0).forEach(function(t){(0,u.Z)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):useMassAction_ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var S=(0,g.Ps)(o||(o=(0,f.Z)(["\n fragment RunActionMutationResult on RunActionResult {\n channel\n failures\n globalFailures\n globalFailureType\n isMassActionsDisabled\n pending\n }\n"]))),$=(0,g.Ps)(c||(c=(0,f.Z)(["\n query ChannelRollup($accountId: ID!, $channelId: ID!) {\n channelRollup(accountId: $accountId, id: $channelId) {\n id\n statuses {\n count\n status\n }\n total\n }\n }\n"]))),z=(0,g.Ps)(s||(s=(0,f.Z)(["\n mutation DeleteRuns($accountId: ID!, $filters: RunFilter!, $runIds: [ID!]) {\n deleteRuns(accountId: $accountId, filters: $filters, runIds: $runIds) {\n ...RunActionMutationResult\n }\n }\n\n ","\n"])),S),C=(0,g.Ps)(l||(l=(0,f.Z)(["\n mutation ReplayRuns($accountId: ID!, $filters: RunFilter!, $runIds: [ID!]) {\n replayRuns(accountId: $accountId, filters: $filters, runIds: $runIds) {\n ...RunActionMutationResult\n }\n }\n\n ","\n"])),S);function hasError(e){var t,n,r,a;return null!=e&&!!e.error||!!((null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(n=t.replayRuns)||void 0===n?void 0:n.globalFailures)||(null==e?void 0:null===(r=e.data)||void 0===r?void 0:null===(a=r.deleteRuns)||void 0===a?void 0:a.globalFailures))}function useMassAction(){var e,t,n,r,o,c,s,l,f,y,g=(0,_.X8)(),m=(0,O.useState)(null),k=m[0],R=m[1],S=(0,b.D)(z),W=(0,p.Z)(S,2),F=W[0],K=W[1],V=(0,b.D)(C),N=(0,p.Z)(V,2),T=N[0],U=N[1],B=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return"replay"===e?n>0:"delete"===e&&t>0}(null==k?void 0:k.type,null==K?void 0:null===(t=K.data)||void 0===t?void 0:null===(n=t.deleteRuns)||void 0===n?void 0:n.pending,null==U?void 0:null===(r=U.data)||void 0===r?void 0:null===(o=r.replayRuns)||void 0===o?void 0:o.pending),G=(0,h.a)($,{skip:!g||!(null!=k&&k.id)||!B,variables:{accountId:g,channelId:null==k?void 0:k.id}}),L=null==G?void 0:null===(c=G.data)||void 0===c?void 0:c.channelRollup,q=!!(null==L?void 0:null===(s=L.statuses)||void 0===s?void 0:s.find(function(e){return"pending"===e.status}));(0,O.useEffect)(function(){B?G.startPolling(3e3):k&&("replay"===k.type&&hasError(U)||"delete"===k.type&&hasError(K)?k.onComplete(!1):k.onComplete(!0),G.stopPolling())},[k]),(0,O.useEffect)(function(){G.loading||q||(G.stopPolling(),k&&k.onComplete(!0))},[q,G.loading]);var H=(0,O.useCallback)((e=(0,d.Z)(v().mark(function _callee(e,t,n){var r,a,o,c,s,l,u;return v().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if("delete"!==e){d.next=8;break}return d.next=3,F({variables:useMassAction_objectSpread({accountId:g},t)});case 3:R({id:(null==(o=d.sent)?void 0:null===(r=o.data)||void 0===r?void 0:null===(a=r.deleteRuns)||void 0===a?void 0:a.channel)||"deleteError",onComplete:n,type:e}),d.next=15;break;case 8:if("replay"!==e){d.next=15;break}return t.zapId,l=(0,i.Z)(t,M),d.next=12,T({variables:useMassAction_objectSpread({accountId:g},l)});case 12:R({id:(null==(u=d.sent)?void 0:null===(c=u.data)||void 0===c?void 0:null===(s=c.replayRuns)||void 0===s?void 0:s.channel)||"replayError",onComplete:n,type:e});case 15:case"end":return d.stop()}},_callee)})),function(t,n,r){return e.apply(this,arguments)}),[F,T,R]),Q=function(e){var t,n=e.channel,r=e.id,o=e.statusResult,c=e.type;if(!n)return c?"replay"===c?{title:"Replaying Zap runs."}:{title:"Deleting Zap run logs."}:null;if(""!==((null==n?void 0:n.globalFailures)||"")||null!=n&&n.globalFailureType)return{link:E[n.globalFailureType],messageType:"error",text:n.globalFailures,title:"Error"};var s=(null==o?void 0:o.id)===n.channel?o:void 0,l=(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){(0,u.Z)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n.failures),((null==s?void 0:s.statuses)||[]).map(function(e){t[e.status]=(t[e.status]||0)+e.count}),t),d=(s?l.pending:n.pending)||0,f=(s?null==s?void 0:s.total:n.pending)+Object.values(n.failures||{}).reduce(function(e,t){return e+t},0);if("replay"===c){if(d)return{text:"".concat(f-d," of ").concat(f," attempted."),title:"Replaying Zap runs."};var y=l.success,v=(0,i.Z)(l,x),g=j()(v),b="".concat(f," Zap ").concat(P()("run",f)," ").concat(P()("was",f)," ").concat(g?"replayed":"attempted",".");return{body:g?void 0:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Object.entries(e).map(function(e){var r,o=(0,p.Z)(e,2),c=o[0],s=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];switch(I()(e)){case Z.VO.success:return"".concat(t," ").concat(P()("run",t)," ran successfully!");case a.paused_zap:return"We didn’t retry ".concat(t," ").concat(P()("run",t)," because their associated Zaps are turned off. Turn on the Zap to enable replay.");case a.successful_task:return n?"We didn’t retry ".concat(t," ").concat(P()("run",t)," because only held runs can be played."):"We didn’t retry ".concat(t," ").concat(P()("run",t)," because ").concat(1===t?"it":"they"," already ran successfully. Replaying only retries failed steps.");case a.outstanding_task:return"We didn’t retry ".concat(t," ").concat(P()("run",t)," because ").concat(1===t?"it's":"they're"," already scheduled for replay.");case a.diverged_zap:return"We didn’t retry ".concat(t," ").concat(P()("run",t)," because the Zap has changed too much.");case a.expired_task:return"We didn’t retry ".concat(t," ").concat(P()("run",t)," because the ").concat(1===t?"run is":"runs are"," too old.");case a.unsuccessful_task:return"".concat(t," ").concat(P()("run",t)," could not be replayed because ").concat(1===t?"it":"they"," failed at the trigger step.");case a.deleted_zap:return"We didn’t retry ".concat(t," ").concat(P()("run",t)," because ").concat(1===t?"its":"their"," associated Zaps no longer exist.");case a.playing_task:return"We didn’t retry ".concat(t," ").concat(P()("run",t)," because playing runs cannot be replayed.");case a.stale_auth:return"We couldn't play ".concat(t," ").concat(P()("run",t)," because a connected account expired.");case a.plan_limit:return"Could not replay ".concat(t," ").concat(P()("run",t)," because this account has hit its plan limit.");case Z.VO.error:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("was",t)," stopped due to a Zap issue.");case Z.VO.halted:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("was",t)," stopped due to a data issue.");case Z.VO.filtered:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("was",t)," stopped because ").concat(1===t?"it was":"they were"," filtered.");case Z.VO.delayed:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("is",t)," waiting on a delay step.");case Z.VO.scheduled:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("is",t)," waiting on a schedule step.");case Z.VO.throttled:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("was",t)," throttled.");case Z.VO.held:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("was",t)," held.");case a.access_blacklisted_app:return"".concat(t," ").concat(P()("run",t)," ").concat(P()("was",t)," held for using restricted apps.");case"":return}}(c,o[1],n);return s?{link:(r=A[c])?r:Z.VO[c]?{href:"/app/history?channel=".concat(t,"&status=").concat(I()(c)),text:"See runs"}:{href:"/app/history?channel=".concat(t,"&channelError=").concat(I()(c)),text:"See runs"},message:s}:null}).filter(Boolean)}(l,r),messageType:g?"success":y?"info":"error",title:b}}if("delete"===c){if(d)return{text:"".concat(f-d," of ").concat(f," attempted."),title:"Deleting Zap run logs."};var h=l.deleted,O=(0,i.Z)(l,D),_=j()(O);return{body:_?void 0:Object.entries(l).map(function(e){var t=(0,p.Z)(e,2),n=function(e,t){switch(I()(e)){case"deleted":return"".concat(t," run ").concat(P()("log",t)," deleted!");case a.expired_task:return"We couldn't delete ".concat(t," run ").concat(P()("log",t)," because ").concat(1===t?"it was":"they were"," too old.");case a.playing_task:return"We couldn't delete ".concat(t," run ").concat(P()("log",t)," because playing runs cannot be deleted.")}}(t[0],t[1]);return n?{message:n}:null}).filter(Boolean),messageType:_?"success":h?"info":"error",title:"".concat(f," run ").concat(P()("log",f)," ").concat(P()("was",f)," deleted.")}}return null}({channel:(null==k?void 0:k.type)==="delete"?null==K?void 0:null===(l=K.data)||void 0===l?void 0:l.deleteRuns:null==U?void 0:null===(f=U.data)||void 0===f?void 0:f.replayRuns,id:null==k?void 0:k.id,statusResult:L,type:null==k?void 0:k.type}),X=(null==k?void 0:k.id)||"new";return{actionError:(0,w.e$)(null!==(y=K.error)&&void 0!==y?y:U.error),isLoading:G.loading||K.loading||U.loading,isRunning:q,message:Q?useMassAction_objectSpread(useMassAction_objectSpread({},Q),{},{id:X}):null,onMassAction:H}}},53861:function(e,t,n){n.d(t,{e$:function(){return getErrorMessage}});var r=n(81333),a=n(45832),hasItem=function(e){return Array.isArray(e)&&e.length>0};function getErrorMessage(e){if(!e)return"";var t=function(e){if(e instanceof a.cA){var t,n,o,c=(0,r.Z)(e.graphQLErrors,1)[0];if(c){var s=null===(t=c.extensions.exception)||void 0===t?void 0:t.errors;if(hasItem(s))return s[0]||"";var l=null===(n=c.extensions.response)||void 0===n?void 0:null===(o=n.body)||void 0===o?void 0:o.errors;return hasItem(l)?l[0]||"":c.message||""}}}(e)||function(e){if(e instanceof a.cA){var t,n=null===(t=e.networkError)||void 0===t?void 0:t.message;if(n)return"Network error: ".concat(n)}}(e)||e.toString()||"";return(null==t?void 0:t.message)||t}}}]);