forked from sindresorhus/awesome
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconnections-02762e0ae33eb013.js.download
90 lines (79 loc) · 43.3 KB
/
connections-02762e0ae33eb013.js.download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4127],{17688:function(e,n,t){"use strict";t.d(n,{g:function(){return h}});var i=t(2784),r=t(28165),o=t(39479),a=t(77293),s=t(61854),l=t(61446),c=t(3e3),u=t(70776),d=t(60196),p=t(61814);const v=(0,o.B)("Field",{root:r.iv`
display: grid;
grid-gap: 5px;
`,helpTextWrapper:r.iv`
${c.ZT.smallPrint1}
`,helpText:r.iv`
display: grid;
grid-template-columns: 1fr auto;
grid-gap: 10px;
align-items: start;
color: ${u.w.neutral700};
`,helpTextInner:r.iv`
padding-top: 1px;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
// Without this truncation won't properly occur.
* {
display: inline;
margin: 0;
}
`,helpTextToggle:r.iv`
cursor: pointer;
text-decoration: underline;
text-transform: lowercase;
// Prevent help text toggle size from changing.
width: 33px;
&:hover,
&:focus {
outline: 1px solid ${u.w.blue};
outline-offset: 1px;
color: ${u.w.blue};
}
`,error:r.iv`
display: inline;
color: ${u.w.error400};
`}),f=({children:e,helpTextLineClamp:n})=>{const[t,r]=(0,i.useState)(!1),[o,s]=(0,d.I)(),l=o&&(0,a.U)("button",{"aria-hidden":"true",css:v.helpTextToggle,onClick:()=>r(!t),type:"button"},t?"Less":"More"),c={WebkitLineClamp:t?void 0:n};return(0,a.U)("div",{css:v.helpText},(0,a.U)("div",{css:v.helpTextInner,ref:e=>s(e),style:c},(0,a.U)("div",null,e)),l)},h=({label:e,renderInput:n,error:t,inputId:r,isDisabled:o,isRequired:c,helpTextLineClamp:u=1,renderHelpText:d,renderLabel:h,requiredText:g})=>{const[m]=(0,i.useState)(r||(0,p.E)("Field-")),b=`${m}-description`,Z=d&&d();return(0,a.U)("div",{css:v.root},(0,a.U)("div",null,h?h({htmlFor:m,isDisabled:o,isErrored:!!t,isRequired:c,label:e,requiredText:g}):(0,a.U)(l.l,{alignItems:"start",htmlFor:m,isDisabled:o,isErrored:!!t,isRequired:c,requiredText:g,size:"small"},t&&(0,a.U)(s.J,{color:"error400",isBlock:!0,name:"formXCircle",size:18}),(0,a.U)("span",null,e))),(0,a.U)("div",null,n({ariaDescribedBy:Z||t?b:void 0,id:m,isDisabled:!!o,isErrored:!!t,isRequired:!!c})),(0,a.U)("div",{"aria-live":t?"polite":"off",css:v.helpTextWrapper,id:b},(Z||t)&&(0,a.U)(f,{helpTextLineClamp:u},t&&(0,a.U)("div",{css:v.error},t," "),Z)))}},61446:function(e,n,t){"use strict";t.d(n,{l:function(){return d}});var i=t(28165),r=t(39479),o=t(77293),a=t(70776),s=t(3e3);const l=(0,r.B)("FormLabelRequiredText",{root:Object.assign(Object.assign({},s.ZT.smallPrint1),{color:a.w.neutral700,textTransform:"lowercase","&::before":{content:'"("'},"&::after":{content:'")"'},'&[data-state="disabled"]':{color:a.w.neutral500}})}),c=({children:e="Required",isDisabled:n=!1})=>(0,o.U)("span",{"aria-hidden":"true",css:l.root,"data-state":n?"disabled":void 0},e),u=(0,r.B)("FormLabel",{root:i.iv`
display: grid;
justify-content: start;
grid-gap: 5px;
grid-auto-flow: column;
grid-auto-columns: auto;
cursor: pointer;
color: ${a.w.neutral700};
&[data-align-items='center'] {
align-items: center;
}
&[data-align-items='start'] {
align-items: start;
}
&[data-justify-content='start'] {
justify-content: start;
}
&[data-justify-content='stretch'] {
justify-content: stretch;
}
&[data-state~='selected'] {
color: ${a.w.blue};
}
&[data-state~='errored'] {
color: ${a.w.error400};
}
&[data-state~='disabled'] {
cursor: not-allowed;
}
&[data-state~='disabled'] {
color: ${a.w.neutral500};
}
&[data-size='small'] {
${s.ZT.smallPrint1Semibold};
}
&[data-size='medium'] {
${s.ZT.paragraph3Medium};
}
&[data-size='medium'][data-state='selected'] {
${s.ZT.paragraph3Semibold}
}
`}),d=({children:e,alignItems:n="center",htmlFor:t,isDisabled:i,isErrored:r,isRequired:a,isSelected:s,justifyContent:l="start",requiredText:d,size:p="medium"})=>(0,o.U)("label",{css:u.root,"data-align-items":n,"data-justify-content":l,"data-size":p,"data-state":[s&&"selected",r&&"errored",i&&"disabled"].filter(Boolean).join(" ")||void 0,htmlFor:t},a&&"*",e,a?d?(0,o.U)(c,{isDisabled:i},d):(0,o.U)(c,{isDisabled:i}):null)},98571:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/connections",function(){return t(11586)}])},11586:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return Cn},default:function(){return In}});var i=t(52903),r=t(97729),o=t.n(r),a=t(92228),s=t(2784),l=t(5632),c=t(28165),u=t(20271),d=t(55414),p=t(20110),v=t(96459),f=t(76635),h=t(9562),g=t(40794),m=t(60138);function b(){var e=(0,a.Z)(["\n fragment AppStats on AppStats {\n authCount\n memberCount\n selectedApi\n zapCount\n }\n"]);return b=function(){return e},e}function Z(){var e=(0,a.Z)(["\n ","\n query GetAppStats($accountId: ID!, $selectedApis: [String!]!) {\n appStats(accountId: $accountId, selectedApis: $selectedApis) {\n ...AppStats\n }\n }\n"]);return Z=function(){return e},e}var y=(0,m.Ps)(b()),x=(0,m.Ps)(Z(),y),w=function(e){var n=e.accountId,t=e.selectedApis,i=(0,g.a)(x,{skip:0===t.length,variables:{accountId:n,selectedApis:t}}),r=i.loading,o=i.data;return{appsStats:(0,s.useMemo)((function(){return(null===o||void 0===o?void 0:o.appStats)||[]}),[o]),isLoading:r}},A=function(e){var n=e.page,t=e.search,i=e.selectedFilter,r=e.accountId,o=(0,h.Z)({page:n,search:t,selectedFilter:i}),a=o.appAlternatives,l=o.connections,c=o.error,u=o.hasMoreApps,d=o.hasPrivate,p=o.isAltLoading,v=o.isLoading,g=o.onLoadMoreApps,m=o.pageCount,b=o.privateLoadingState,Z=o.publicLoadingState,y=(0,s.useMemo)((function(){return l.map((function(e){return e.selectedApi})).filter(Boolean)}),[l]),x=w({accountId:r,selectedApis:y}),A=x.appsStats,S=x.isLoading;return{appAlternatives:a,apps:(0,s.useMemo)((function(){if(A){var e=(0,f.keyBy)(A,"selectedApi");return l.map((function(n){return n.stats=n.selectedApi?e[n.selectedApi]:void 0,n}))}return l}),[A,l]),error:c,hasMoreApps:u,hasPrivate:d,isAltLoading:p,isAppsStatsLoading:S,isLoading:v,onLoadMoreApps:g,pageCount:m,privateLoadingState:b,publicLoadingState:Z}},S=t(70398),C=t(70776),I=t(61854),k=t(53939),L=(0,c.iv)("align-items:center;border:1px solid ",C.w.neutral300,";border-radius:5px;display:flex;flex-direction:column;justify-content:center;padding:30px 60px;","EmptySection.tsx--innerStyle"),P=(0,c.iv)("width:100%;","EmptySection.tsx--innerFullWidth"),T=(0,c.iv)("align-items:center;display:flex;text-align:center;","EmptySection.tsx--rootStyle");var z=function(e){return(0,i.tZ)("div",{css:T,children:(0,i.BX)("div",{css:[L,e.isFullWidth&&P],children:[(0,i.tZ)(I.J,{color:"neutral400",name:"navSearch",size:24}),(0,i.tZ)(k.L,{height:20}),(0,i.tZ)(d.x,{type:"smallPrint1Bold",children:e.title})]})})},_=t(82116),F=t(64476),M=t(73223),B=t(42722),N=(0,c.iv)("align-items:center;display:grid;grid-gap:15px;grid-template-columns:40px 1fr auto;justify-content:flex-start;","AppAlternative.tsx--rootStyle");var q,$=function(e){var n,t=e.app,r=e.onClick,o=Object.prototype.hasOwnProperty.call(t,"name")?t.name:t.title,a=Object.prototype.hasOwnProperty.call(t,"image")?t.image:null===(n=t.images)||void 0===n?void 0:n.url128x128;return o?(0,i.tZ)(B.Z,{children:(0,i.BX)("div",{css:N,children:[(0,i.tZ)(F.A,{serviceName:o,size:40,src:a||M.hn}),(0,i.tZ)(d.x,{type:"paragraph3Bold",children:o}),(0,i.tZ)(p.z,{color:"secondary",onClick:function(){return r(t)},size:"small",children:"Connect"})]})}):null},X=t(90982),E=t(47043);!function(e){e[e.empty=0]="empty",e[e.initial=1]="initial",e[e.loaded=2]="loaded",e[e.more=3]="more"}(q||(q={}));var U=t(66383),j=t(29416),R=t(87593),O=t(49187),D=t(15879),W=t(19928),K=t.n(W);function H(){var e=(0,a.Z)(['\n align-items: center;\n display: grid;\n grid-column-gap: 10px;\n grid-row-gap: 5px;\n grid-template-areas: "icon name arrowNeedsAttention" "connections connections connections" "zaps zaps zaps";\n grid-template-columns: 40px 1fr auto;\n grid-template-rows: 40px 1fr 1fr;\n overflow: hidden;\n ']);return H=function(){return e},e}function J(){var e=(0,a.Z)(['\n grid-column-gap: 15px;\n grid-template-areas: "icon name needsAttention connections zaps arrow";\n grid-template-columns: 40px 1fr 25px '," "," 20px;\n grid-template-rows: 1fr;\n overflow: visible;\n "]);return J=function(){return e},e}function V(){var e=(0,a.Z)(['\n grid-template-areas: "icon name arrowNeedsAttention" "members members members" "connections connections connections" "zaps zaps zaps";\n grid-template-rows: 40px 1fr 1fr 1fr;\n ']);return V=function(){return e},e}function G(){var e=(0,a.Z)(['\n grid-template-areas: "icon name needsAttention members connections zaps arrow";\n grid-template-columns: 40px 1fr 25px '," "," "," 20px;\n grid-template-rows: 1fr;\n "]);return G=function(){return e},e}function Q(){var e=(0,a.Z)(['\n grid-template-areas: "icon name arrowNeedsAttention" "tag tag tag" "connections connections connections" "zaps zaps zaps";\n grid-template-rows: 40px 1fr 1fr 1fr;\n ']);return Q=function(){return e},e}function Y(){var e=(0,a.Z)(['\n grid-template-areas: "icon name needsAttention tag connections zaps arrow";\n grid-template-columns: 40px 1fr 25px '," "," "," 20px;\n grid-template-rows: 1fr;\n "]);return Y=function(){return e},e}function ee(){var e=(0,a.Z)(['\n grid-template-areas: "icon name arrowNeedsAttention" "tag tag tag" "members members members" "connections connections connections" "zaps zaps zaps";\n grid-template-rows: 40px 1fr 1fr 1fr 1fr;\n ']);return ee=function(){return e},e}function ne(){var e=(0,a.Z)(['\n grid-template-areas: "icon name needsAttention tag members connections zaps arrow";\n grid-template-columns: 40px 1fr 25px '," "," "," "," 20px;\n grid-template-rows: 1fr;\n "]);return ne=function(){return e},e}var te=(0,c.iv)("display:grid;grid-template-rows:auto auto;","AppListItem.tsx--privateNameStyle"),ie="100px",re="80px",oe=(0,S.uq)({mobile:(0,c.iv)(H()),desktop:(0,c.iv)(J(),ie,ie)}),ae=(0,S.uq)({mobile:(0,c.iv)(V()),desktop:(0,c.iv)(G(),ie,ie,ie)}),se=(0,S.uq)({mobile:(0,c.iv)(Q()),desktop:(0,c.iv)(Y(),re,ie,ie)}),le=(0,S.uq)({mobile:(0,c.iv)(ee()),desktop:(0,c.iv)(ne(),re,ie,ie,ie)}),ce=function(e){var n,t,r,o,a,s,l=e.app,c=e.hasTeams,u=e.isAdmin,p=e.isAppsStatsLoading,v=l.isPrivate?"".concat(M.Xu,"/private/").concat(l.selectedApi):"".concat(M.Xu,"/").concat(l.slug),f=u&&c,h="",g=l.title;if(l.isPrivate){var m,b=(0,U.Z)((null===(m=l.selectedApi)||void 0===m?void 0:m.split("@"))||[],2),Z=b[0],y=b[1];h=y?"v".concat(y):"Custom integration",g=g||Z}return(0,i.tZ)(B.Z,{href:v,children:(0,i.BX)("div",{css:[oe,f&&ae,l.isPrivate&&se,f&&l.isPrivate&&le],"data-testid":"AppListItem",children:[(0,i.tZ)("div",{css:(0,O.f)("icon"),children:(0,i.tZ)(F.A,{serviceName:g,size:40,src:(null===(n=l.images)||void 0===n?void 0:n.url128X128)||M.hn})}),(0,i.BX)("div",{css:[(0,O.f)("name"),l.isPrivate&&te],children:[(0,i.tZ)(d.x,{type:"paragraph1ShortBold",children:g}),h&&(0,i.tZ)(d.x,{type:"smallPrint3",children:h})]}),l.isPrivate&&(0,i.tZ)("div",{css:(0,O.f)("tag"),children:l.banner&&(0,i.tZ)(j.S,{color:"info",size:"small",children:l.banner})}),(0,i.tZ)("div",{css:(0,O.f)("connections"),children:(0,i.tZ)(D.Z,{count:null===(t=l.stats)||void 0===t?void 0:t.authCount,isLoading:!l.stats&&p,label:"Connection"})}),f&&(0,i.tZ)("div",{css:(0,O.f)("members"),children:(0,i.tZ)(D.Z,{count:null===(r=l.stats)||void 0===r?void 0:r.memberCount,isLoading:!l.stats&&p,label:"Member"})}),(0,i.tZ)("div",{css:(0,O.f)("zaps"),children:(0,i.tZ)(D.Z,{count:null===(o=l.stats)||void 0===o?void 0:o.zapCount,isLoading:!l.stats&&p,label:"Zap"})}),(0,i.tZ)("div",{css:[S.eI,(0,O.f)("needsAttention")],children:l.hasStaleAuth&&(0,i.tZ)(R.p,{content:"Check app ".concat(K()("connection",null===(a=l.stats)||void 0===a?void 0:a.authCount)),position:"south",showTooltipOnTouchDevices:!1,children:function(){return(0,i.tZ)(I.J,{color:"error400",name:"formXCircle",size:25})}})}),(0,i.tZ)("div",{css:[S.eI,(0,O.f)("arrow")],children:(0,i.tZ)(I.J,{color:"neutral600",name:"arrowSmallRight",size:25})}),(0,i.tZ)("div",{css:[S.Q0,(0,O.f)("arrowNeedsAttention")],children:l.hasStaleAuth?(0,i.tZ)(R.p,{content:"Check app ".concat(K()("connection",null===(s=l.stats)||void 0===s?void 0:s.authCount)),position:"west",children:function(){return(0,i.tZ)(I.J,{color:"error400",name:"formXCircle",size:25})}}):(0,i.tZ)(I.J,{color:"neutral600",name:"arrowSmallRight",size:25})})]})})},ue=(0,c.iv)("display:grid;grid-auto-rows:min-content;grid-gap:20px;","AppList.tsx--rootStyle");var de=function(e){var n=e.apps,t=e.handlePage,r=e.hasTeams,o=e.isAdmin,a=e.isAppsStatsLoading,s=e.page,l=e.pageCount,c=e.pageUrls,u=e.privateLoadingState,d=e.publicLoadingState,p=(0,i.tZ)(_.Z,{gap:10,itemRenderer:function(e){return(0,i.tZ)(ce,{app:e,hasTeams:!!r,isAdmin:o,isAppsStatsLoading:a},e.id)},items:n,testId:"AppList"}),v=l>1&&(0,i.tZ)(X.D,{currentPageIndex:s,isCentered:!0,onPaginate:t,pageUrls:c}),f=u===q.initial||u===q.empty&&d===q.empty||d===q.initial?(0,i.tZ)(_.Z,{gap:10,itemRenderer:function(){return(0,i.tZ)(E.q,{height:77,width:"100%"})},items:Array.from({length:5})}):null;return(0,i.BX)("div",{css:ue,children:[p,f,v]})},pe=t(39097),ve=t.n(pe),fe=t(3e3),he=t(98628),ge=[{getLabel:function(e){return e.hasTeams?"My apps":"All apps"},value:"myApps"},{getLabel:function(){return"Shared with me"},shouldRender:function(e){return!!e.hasTeams},value:"sharedWithMe"},{getLabel:function(){return"Other apps"},value:"private"},{getLabel:function(){return"All apps"},shouldRender:function(e){var n=e.isAdmin,t=e.hasTeams;return!!n&&!!t},tag:"Admin",value:"all"}],me=(0,c.iv)("display:grid;grid-auto-rows:max-content;grid-gap:25px;","AppListingSidebar.tsx--rootStyle"),be=(0,c.iv)("align-items:center;display:grid;grid-auto-flow:column;grid-gap:10px;justify-content:flex-start;","AppListingSidebar.tsx--innerStyle"),Ze=(0,c.iv)(fe.ZT.paragraph3Semibold," line-height:1;a{display:flex;border-radius:3px;padding:10px 20px;transition:",he.f.transitionValue,";margin-bottom:5px;color:",C.w.neutral800,";transition:",he.f.transitionValue,";text-decoration:none;&:hover,&:focus{color:",C.w.blue,";background-color:",C.w.acidWash,";}}","AppListingSidebar.tsx--linkStyle"),ye=(0,c.iv)("a{background-color:",C.w.acidWash,";color:",C.w.blue,";&:hover,&:focus{background-color:",C.w.acidWash,";color:",C.w.blue,";}}","AppListingSidebar.tsx--selectedStyle"),xe=function(e){var n=e.showNeedsAuth,t=e.hasTeams,r=e.isAdmin,o=e.selectedFilter,a=e.onSelectFilter,l=(0,s.useMemo)((function(){return ge.filter((function(e){return!e.shouldRender||e.shouldRender({hasTeams:t,isAdmin:r,showNeedsAuth:n})}))}),[t,r,n]);return(0,i.BX)("div",{css:me,children:[(0,i.tZ)(d.x,{tag:"h1",type:"sectionHeader1Medium",children:"Apps"}),(0,i.tZ)("nav",{"aria-label":"App filters",children:(0,i.tZ)("ul",{children:l.map((function(e){var n=e.tag,s=e.getLabel,l=e.value,c=l===o,u="".concat(M.Xu,"?type=").concat(l);return(0,i.tZ)("li",{css:[Ze,c&&ye],children:(0,i.tZ)(ve(),{href:u,onClick:function(e){e.preventDefault(),a(l)},legacyBehavior:!1,children:(0,i.BX)("span",{css:be,children:[s({hasTeams:t,isAdmin:r}),n&&(0,i.tZ)(j.S,{color:"error",size:"small",children:n})]})})},l)}))})})]})},we=t(81901),Ae=t(98788),Se=t(70865),Ce=t(96670),Ie=t(5163),ke=t(28952),Le=t(66266),Pe=t(17688),Te=t(42126),ze=t(22211),_e=t(59712),Fe=t(57037),Me=t(53736),Be=t(38017),Ne=t(50293),qe=(0,c.iv)("align-items:center;background:inherit;border:none;cursor:pointer;display:flex;height:100%;justify-content:center;width:100%;","ClearSelectionButton.tsx--clearSelectionButtonStyle"),$e=function(e){var n=e.clearSelection,t=e.isFocused,r=e.isHovered,o=t||r?void 0:"neutral600";return(0,i.tZ)("button",{css:qe,onClick:n,title:"Clear Selection",children:(0,i.tZ)(I.J,{canAcceptPointerEvents:!1,color:o,name:"x",size:20})})},Xe=(0,c.iv)(fe.ZT.smallPrint1," width:100%;align-items:center;border-radius:10px;cursor:pointer;display:inline-table;height:40px;padding:10px;&:hover,&:focus-within{",fe.ZT.smallPrint1," background-color:",C.w.ocean5,";color:",C.w.ocean,";font-weight:600;}","NewAppConnectionListItem.tsx--menuItemBase"),Ee=(0,c.iv)('all:unset;width:100%;> span{display:grid;grid-template-areas:"icon name";grid-template-columns:40px 1fr;grid-template-rows:1fr;grid-gap:10px;align-items:center;}',"NewAppConnectionListItem.tsx--buttonRoot"),Ue=function(e){var n,t=e.connection,r=e.createNewConnection,o=Object.prototype.hasOwnProperty.call(t,"title")?t.title:(null===t||void 0===t?void 0:t.name)||"",a=Object.prototype.hasOwnProperty.call(t,"images")?(null===(n=t.images)||void 0===n?void 0:n.url128X128)||M.hn:(null===t||void 0===t?void 0:t.image)||M.hn;return(0,i.tZ)("li",{css:Xe,children:(0,i.tZ)("button",{css:Ee,onClick:function(){return r(t)},children:(0,i.BX)("span",{children:[(0,i.tZ)(F.A,{serviceName:o,size:40,src:a}),(0,i.tZ)(d.x,{children:o})]})})})},je=(0,c.iv)("display:grid;grid-gap:10px;min-width:min(75vw,660px);","AppConnectionModal.tsx--root"),Re=(0,c.iv)("border-radius:10px;border:1px solid ",C.w.neutral300,";padding:5px 0;","AppConnectionModal.tsx--listWrapper"),Oe=(0,c.iv)("display:grid;max-height:250px;overflow:auto;","AppConnectionModal.tsx--appConnectionList"),De="Add a new app connection",We=function(){(0,_e.jj)("open AppConnectionModal");var e=(0,s.useState)(""),n=e[0],t=e[1],r=(0,Fe.Z)(n),o=(0,Me.l)().createNotification,a=(0,h.Z)({search:r}),c=a.connections,u=a.isLoading,p=(0,Be.Z)(r).results,v=(0,l.useRouter)(),f=(0,Ne.Z)(),g=(0,s.useCallback)(function(){var e=(0,Ae.Z)((function(e){var n;return(0,Ie.__generator)(this,(function(t){switch(t.label){case 0:return[4,f(e)];case 1:return(n=t.sent().id)&&(v.push("".concat(M.Xu,"/").concat(e.slug,"?hl=").concat(n)),o({message:"New connection added",type:"info"})),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),[v,f,o]);return(0,i.BX)("div",{css:je,children:[(0,i.tZ)(d.x,{tag:"h1",type:"paragraph1Bold",children:De}),(0,i.tZ)(Pe.g,{label:"App name",renderInput:function(e){return(0,i.tZ)(Te.o,(0,Ce.Z)((0,Se.Z)({},e),{ariaLabel:"New App Search",autoComplete:"off",onChange:function(e){return t(e.currentTarget.value)},placeholder:"Search for app",renderIconAfter:function(e){var r=e.isFocused,o=e.isHovered;return n.length>0&&(0,i.tZ)($e,{clearSelection:function(){return t("")},isFocused:r,isHovered:o})},renderIconBefore:function(e){var n=e.iconSize;return u?(0,i.tZ)(ze.$,{}):(0,i.tZ)(I.J,{name:"magnifyingGlass",size:n})},value:n}))}}),!!p.length&&(0,i.tZ)("div",{css:Re,children:(0,i.tZ)("ul",{css:Oe,children:p.map((function(e){return(0,i.tZ)(Ue,{connection:e,createNewConnection:g},e.id)}))})}),c.length>0&&!p.length&&(0,i.tZ)("div",{css:Re,children:(0,i.tZ)("ul",{css:Oe,children:c.map((function(e){return(0,i.tZ)(Ue,{connection:e,createNewConnection:g},e.id)}))})})]})},Ke=function(e){var n=e.onClose;return(0,i.tZ)(ke.u,{onClosed:n,ariaLabel:De,children:(0,i.tZ)(Le.hz,{children:(0,i.tZ)(We,{})})})},He=function(e){var n=e.value,t=e.isSearching,r=void 0!==t&&t,o=e.handleToggle,a=e.onChange,l=(0,s.useState)(n||""),c=l[0],u=l[1],d=(0,s.useState)(""),p=d[0],v=d[1],f=(0,Fe.Z)(c,500);(0,s.useEffect)((function(){u((function(e){return n!==e?n||"":e}))}),[n]),(0,s.useEffect)((function(){f!==p&&(a(f),v(f))}),[f,a,p]);var h=(0,s.useCallback)((function(e){u((function(n){var t,i;return(null===(t=e.target)||void 0===t?void 0:t.value)!==n?null===(i=e.target)||void 0===i?void 0:i.value:n}))}),[]);return(0,i.tZ)(Te.o,{ariaLabel:"App Search",autoComplete:"off",onBlur:function(){0===c.length&&"function"===typeof o&&o()},onChange:h,placeholder:"Search apps",renderIconAfter:function(e){var n=e.isFocused,t=e.isHovered;return c.length>0&&(0,i.tZ)($e,{clearSelection:function(){return u("")},isFocused:n,isHovered:t})},renderIconBefore:function(e){var n=e.iconSize;return r?(0,i.tZ)(ze.$,{}):(0,i.tZ)(I.J,{name:"magnifyingGlass",size:n})},value:c})},Je=t(90446),Ve=t(38716);function Ge(){var e=(0,a.Z)(["\n grid-auto-flow: column;\n justify-content: flex-end;\n "]);return Ge=function(){return e},e}function Qe(){var e=(0,a.Z)(["\n align-items: center;\n display: grid;\n "]);return Qe=function(){return e},e}function Ye(){var e=(0,a.Z)(["\n max-width: 240px;\n "]);return Ye=function(){return e},e}function en(){var e=(0,a.Z)(["\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n gap: 10px;\n "]);return en=function(){return e},e}function nn(){var e=(0,a.Z)(["\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-end;\n "]);return nn=function(){return e},e}function tn(){var e=(0,a.Z)(["\n > * {\n flex: 1 1 100% !important;\n width: 100% !important;\n min-width: 0 !important;\n }\n "]);return tn=function(){return e},e}function rn(){var e=(0,a.Z)(["\n > * {\n width: auto;\n }\n "]);return rn=function(){return e},e}var on=(0,S.uq)({tablet:(0,c.iv)(Ge()),mobile:(0,c.iv)(Qe())}),an=(0,c.iv)("justify-content:unset;grid-template-columns:1fr auto auto;","AppsHeader.tsx--rootWithTitle"),sn=(0,S.uq)({tablet:(0,c.iv)(Ye())}),ln=(0,S.uq)({mobile:(0,c.iv)(en()),tablet:(0,c.iv)(nn())}),cn=(0,S.uq)({mobile:(0,c.iv)(tn()),tablet:(0,c.iv)(rn())}),un=function(e){var n=e.handleSearch,t=e.showTitle,r=e.hasTeams,o=e.isAdmin,a=e.onSelectFilter,l=e.searchValue,c=void 0===l?"":l,u=e.selectedFilter,v=void 0===u?ge[0].value:u,f=(0,s.useState)(!1),h=f[0],g=f[1],m=(0,Ve.X8)(),b=(0,s.useCallback)((function(){(0,Je.Z)({account_id:m,event_action:"click",interaction_name:"add_connection_button",option_selected:"add connection",system_name:"reporting",interaction_raw_text:"Add Connection"},M.rw)}),[m]),Z=function(){g((function(e){return!e})),b()};return(0,i.BX)("div",{children:[(0,i.BX)("div",{css:[on,t&&an],children:[t&&(0,i.tZ)("span",{css:S.pI,children:(0,i.tZ)(d.x,{tag:"h1",type:"sectionHeader1Medium",children:"Apps"})}),(0,i.BX)("div",{css:ln,children:[!!v&&(0,i.tZ)("div",{css:[S.CD,cn],children:(0,i.tZ)(we.L,{getLabelForItem:function(e){return e.getLabel({hasTeams:r,isAdmin:o})},items:ge,onChange:function(e){return a(e.value)},selectedItem:ge.find((function(e){return e.value===v}))})}),(0,i.tZ)("div",{css:[sn],children:(0,i.tZ)(He,{onChange:n,value:c})}),(0,i.tZ)(p.z,{iconBefore:"formAdd",onClick:Z,size:"small",children:"Add connection"})]})]}),h&&(0,i.tZ)(Ke,{onClose:Z})]})},dn=function(){var e=(0,l.useRouter)(),n="string"===typeof e.query.search?e.query.search:"",t=(0,s.useState)(n),i=t[0],r=t[1],o=(0,s.useCallback)((function(e){e!==i&&r(e)}),[i]);return{search:i,setSearch:o}},pn=function(e){var n=e.setSearch,t=e.selectedFilter,i=(0,l.useRouter)(),r=(0,Ne.Z)(),o=(0,s.useCallback)(function(){var e=(0,Ae.Z)((function(e,n){var t;return(0,Ie.__generator)(this,(function(r){switch(r.label){case 0:return t=Object.keys(e).map((function(n){var t=e[n];return(0,f.isNull)(t)||0===t||""===t||(0,f.isObject)(t)&&(0,f.isEmpty)(t)?n:void 0})).filter(Boolean),[4,i.push({pathname:i.pathname,query:(0,Se.Z)({},(0,f.omit)(i.query,t),(0,f.omit)(e,t))},void 0,{shallow:!0})];case 1:return r.sent(),n&&n(),[2]}}))}));return function(n,t){return e.apply(this,arguments)}}(),[i]),a=(0,s.useCallback)((function(e,n){n.preventDefault();var t=e.pageIndex;String(i.query.page)!==String(t)&&o({page:e.pageIndex})}),[o,i]),c=(0,s.useCallback)((function(e){e!==t&&o({type:e,search:null,page:null},(function(){n("")}))}),[t,n,o]),u=(0,s.useCallback)((function(e){n(e),o({search:e})}),[n,o]),d=function(){var e=(0,Ae.Z)((function(e){var n;return(0,Ie.__generator)(this,(function(t){switch(t.label){case 0:return e?[4,r(e)]:[3,2];case 1:(n=t.sent().id)&&i.push("".concat(M.Xu,"/").concat(e.slug,"?hl=").concat(n)),t.label=2;case 2:return[2]}}))}));return function(n){return e.apply(this,arguments)}}();return{page:a,changeFilter:c,connectApp:d,search:u}},vn=t(16181);function fn(){var e=(0,a.Z)(["\n display: grid;\n grid-gap: 0px;\n grid-template-columns: 0px 1fr;\n margin: 0px auto;\n max-width: 1120px;\n padding: 20px;\n "]);return fn=function(){return e},e}function hn(){var e=(0,a.Z)(["\n grid-gap: 60px;\n grid-template-columns: 270px 1fr;\n "]);return hn=function(){return e},e}function gn(){var e=(0,a.Z)(["\n grid-template-columns: 1fr;\n "]);return gn=function(){return e},e}function mn(){var e=(0,a.Z)(["\n grid-gap: 0;\n grid-template-columns: 1fr;\n "]);return mn=function(){return e},e}var bn=(0,c.iv)("display:grid;grid-gap:10px;","Apps.tsx--altStyle"),Zn=(0,c.iv)("display:grid;grid-auto-rows:min-content;grid-gap:20px;","Apps.tsx--detailsStyle"),yn=(0,c.iv)("display:flex;justify-content:center;","Apps.tsx--exploreStyle"),xn=(0,S.uq)({mobile:(0,c.iv)(fn()),tablet:(0,c.iv)(hn())}),wn=(0,S.uq)({mobile:(0,c.iv)(gn()),tablet:(0,c.iv)(mn())});function An(e,n){return n?"No matching connections":"myApps"===e?"You don't have any personal apps.":"private"===e?"You don't have any other apps.":"needsAuthentication"===e?"All apps are connected":"You don't have any apps."}var Sn=function(){var e=(0,s.useState)(!1),n=e[0],t=e[1],r=(0,s.useState)(!1),o=r[0],a=r[1],c=(0,s.useState)(!1),f=c[0],h=c[1],g=(0,s.useState)(!1),m=g[0],b=g[1],Z=(0,l.useRouter)(),y=(0,vn.gn)(),x=y.accountId,w=void 0===x?"":x,C=y.isTeam,I=y.isAdmin,k=dn(),L=k.search,P=k.setSearch,T="string"===typeof Z.query.page?parseInt(Z.query.page):0,F=Z.query.type||"myApps",M=pn({setSearch:P,selectedFilter:F}),B=A({accountId:w.toString(),page:T,search:L,selectedFilter:F}),N=B.appAlternatives,q=B.apps,X=B.error,E=B.hasMoreApps,U=B.hasPrivate,j=B.isAltLoading,R=B.isAppsStatsLoading,O=B.isLoading,D=B.onLoadMoreApps,W=B.pageCount,K=B.privateLoadingState,H=B.publicLoadingState,J=(0,s.useMemo)((function(){return Array.from({length:W||0},(function(e,n){return(0,v.Sr)(Z.asPath,{page:n})}))}),[W,Z]);return(0,s.useEffect)((function(){b(X)}),[X]),(0,s.useEffect)((function(){t(!(!U&&!C))}),[U,C]),(0,s.useEffect)((function(){a((null===N||void 0===N?void 0:N.length)>0&&!j)}),[N,j]),(0,s.useEffect)((function(){h(!O&&!m&&0===(null===q||void 0===q?void 0:q.length))}),[O,m,q]),(0,i.BX)("div",{css:[!n&&wn,xn],children:[(0,i.tZ)("div",{children:n&&(0,i.tZ)("div",{css:S.pI,children:(0,i.tZ)(xe,{hasTeams:C,isAdmin:I,onSelectFilter:M.changeFilter,selectedFilter:F,showNeedsAuth:!0})})}),(0,i.BX)("div",{css:Zn,children:[(0,i.tZ)(un,{handleSearch:M.search,hasTeams:C,isAdmin:I,onSelectFilter:M.changeFilter,showTitle:!n,searchValue:L,selectedFilter:F}),m&&(0,i.tZ)(u.b,{type:"error",children:X}),f&&(0,i.tZ)(z,{isFullWidth:!0,title:An(F,L)}),!m&&(0,i.tZ)(de,{apps:q,handlePage:M.page,hasMoreApps:E,hasTeams:Boolean(C),isAdmin:I,isAppsStatsLoading:R,onLoadMoreApps:D,page:T,pageCount:W,pageUrls:J,privateLoadingState:K,publicLoadingState:H}),o&&(0,i.BX)("div",{css:bn,children:[(0,i.tZ)(d.x,{type:"paragraph3",children:"Add new connection"}),(0,i.tZ)(_.Z,{gap:10,itemRenderer:function(e){return(0,i.tZ)($,{app:e,onClick:M.connectApp})},items:N}),(0,i.tZ)("div",{css:yn,children:(0,i.tZ)(p.z,{color:"secondary",href:"/explore",children:"Explore more connections"})})]})]})]})},Cn=!0;function In(){return(0,i.BX)("div",{children:[(0,i.tZ)(o(),{children:(0,i.tZ)("title",{children:"My Apps | Zapier"})}),(0,i.tZ)(Sn,{})]})}},82116:function(e,n,t){"use strict";var i=t(52903),r=t(28165),o=function(e){var n,t=e.items.map((function(n,t){return(0,i.tZ)("li",{"data-testid":e.testId,children:e.itemRenderer(n,t)},e.getKey(n,t))}));return(0,i.tZ)("ul",{css:(n=e.gap,(0,r.iv)("list-style-type:none;display:flex;flex-direction:column;gap:",n,"px;li > a{text-decoration:none !important;}","List.tsx--rootStyle")),id:e.id,children:t})};o.defaultProps={getKey:function(e,n){return n},gap:10},n.Z=o},42722:function(e,n,t){"use strict";t.d(n,{Z:function(){return S}});var i=t(70865),r=t(96670),o=t(92228),a=t(52903),s=t(28165),l=t(39097),c=t.n(l),u=t(70776),d=t(98628),p=t(10391),v=t(70398),f=t(76635),h=t(29620),g=t.n(h),m=function(e){return Array.isArray(e)?e:[e]};function b(){var e=(0,o.Z)(["\n display: block;\n text-decoration: none !important;\n background-color: ",";\n border: "," solid\n ",";\n border-radius: 5px;\n padding: 15px;\n transition: ",";\n &:hover,\n &:focus {\n background-color: ",";\n border: 1px solid ",";\n box-shadow: ",";\n outline: 0;\n }\n "]);return b=function(){return e},e}function Z(){var e=(0,o.Z)(["\n padding: 15px 20px;\n "]);return Z=function(){return e},e}var y={blue:{base:{backgroundColor:u.w.acidWash,border:u.w.blue},hover:{backgroundColor:u.w.neutral100,border:u.w.blue}},gray:{base:{backgroundColor:u.w.neutral100,border:u.w.neutral300},hover:{backgroundColor:u.w.neutral100,border:u.w.neutral300}},red:{base:{backgroundColor:u.w.neutral100,border:u.w.error400},hover:{backgroundColor:u.w.neutral100,border:u.w.error400}},white:{base:{backgroundColor:u.w.neutral100,border:u.w.blue},hover:{backgroundColor:u.w.neutral100,border:u.w.blue}}},x=function(e){return(0,v.uq)({mobile:(0,s.iv)(b(),y[e.color].base.backgroundColor,"red"===e.color?"2px":"1px",y[e.color].base.border,d.f.transitionValue,y[e.color].hover.backgroundColor,y[e.color].hover.border,p.f.elevation5),tablet:(0,s.iv)(Z())})},w=(0,s.iv)("cursor:pointer;","ListItem.tsx--clickableStyle"),A=function(e){var n,t,o=!e.href&&e.onClick?{onClick:e.onClick,onKeyDown:(n=["enter","space"],t=function(n){e.onClick&&e.onClick(n)},function(e){var i=m(n);(0,f.some)(i,(function(n){return e.keyCode===Number(g()(n))}))&&t(e)}),role:"button",tabIndex:0}:{};return e.href?(0,a.tZ)(c(),(0,r.Z)((0,i.Z)({href:e.href,target:e.target,legacyBehavior:!1},o),{children:(0,a.tZ)("span",{css:x(e),children:e.children})})):(0,a.tZ)("div",(0,r.Z)((0,i.Z)({css:[x(e),e.onClick&&w]},o),{children:e.children}))};A.defaultProps={color:"gray"};var S=A},15879:function(e,n,t){"use strict";t.d(n,{Z:function(){return A}});var i=t(92228),r=t(52903),o=t(19928),a=t.n(o),s=t(28165),l=t(47043),c=t(55414),u=t(76635),d=["","k","M","B","T",""],p=function(e){if(!e||e<1&&e>-1)return(0,u.isNumber)(e)?e.toString():null;var n=Math.floor(Math.log(Math.abs(e))/Math.log(1e3)),t=d[Math.min(n,d.length)],i=String(Math.abs(e)/Math.pow(1e3,n)).substring(0,3),r=i.endsWith(".")?i.slice(0,-1):i;return"".concat(e<0?"-":"").concat(r).concat(t)},v=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(!e)return 0;var t=Math.floor(Math.log10(Math.abs(e))),i=t-n,r=e/Math.pow(10,i),o=Math[e<0?"floor":"ceil"](r);return parseFloat((o*Math.pow(10,i)).toPrecision(12))},f=function(e){var n=e.children,t=e.infinityLabel,i=void 0===t?"Infinity":t,o=e.isAbbreviated,a=void 0!==o&&o,s=e.isFriendly,l=void 0!==s&&s,c=e.isNegativeOneInfinity,d=void 0!==c&&c,f=e.maxDecimals,h=void 0===f?2:f,g=e.minDecimals,m=void 0===g?0:g,b=e.nanLabel,Z=void 0===b?"NaN":b,y=n;return(0,u.isNaN)(y)||!(0,u.isNumber)(y)?(0,r.tZ)("span",{children:Z}):!(0,u.isFinite)(y)||d&&-1===y?(0,r.tZ)("span",{children:i}):(l&&(y=v(y)),y=a?p(y):y.toLocaleString(void 0,{maximumFractionDigits:h,minimumFractionDigits:m}),(0,r.tZ)("span",{title:a?n.toLocaleString():void 0,children:y}))},h=t(70398),g=t(49187);function m(){var e=(0,i.Z)(["\n align-items: center;\n display: grid;\n grid-gap: 5px;\n grid-template-columns: auto 1fr;\n "]);return m=function(){return e},e}function b(){var e=(0,i.Z)(["\n grid-gap: 0px;\n grid-template-columns: 1fr;\n text-align: center;\n "]);return b=function(){return e},e}function Z(){var e=(0,i.Z)(["\n height: 20px;\n overflow: hidden;\n "]);return Z=function(){return e},e}function y(){var e=(0,i.Z)(["\n height: 40px;\n "]);return y=function(){return e},e}var x=(0,h.uq)({mobile:(0,s.iv)(m()),desktop:(0,s.iv)(b())}),w=(0,h.uq)({mobile:(0,s.iv)(Z()),desktop:(0,s.iv)(y())}),A=function(e){var n=e.isLoading,t=e.label,i=e.count;return n?(0,r.tZ)("div",{css:w,children:(0,r.tZ)(l.q,{height:"100%",width:"100%"})}):(0,r.BX)("div",{css:[x,(0,g.f)(e.label.toLowerCase())],children:[(0,r.tZ)(c.x,{type:"paragraph3Bold",children:(0,r.tZ)(f,{children:i||0})}),(0,r.tZ)(c.x,{tag:"div",type:"smallPrint1",children:a()(t,i)})]})}},70398:function(e,n,t){"use strict";t.d(n,{CD:function(){return c},Q0:function(){return p},eI:function(){return u},pI:function(){return d},uq:function(){return l}});var i=t(47842),r=t(28165),o="@media (min-width: 0)",a="@media (min-width: 660px)",s="@media (min-width: 1024px)",l=function(e){return[e.mobile?(0,i.Z)({},o,(0,r.iv)(e.mobile)):void 0,e.tablet?(0,i.Z)({},a,(0,r.iv)(e.tablet)):void 0,e.desktop?(0,i.Z)({},s,(0,r.iv)(e.desktop)):void 0].filter(Boolean)},c=l({mobile:{display:"inherit",visibility:"visible"},tablet:{display:"none",visibility:"hidden"},desktop:{display:"none",visibility:"hidden"}}),u=(l({mobile:{display:"none",visibility:"hidden"},tablet:{display:"inherit",visibility:"visible"},desktop:{display:"none",visibility:"hidden"}}),l({mobile:{display:"none",visibility:"hidden"},tablet:{display:"none",visibility:"hidden"},desktop:{display:"inherit",visibility:"visible"}})),d=l({mobile:{display:"none",visibility:"hidden"},tablet:{display:"inherit",visibility:"visible"},desktop:{display:"inherit",visibility:"visible"}}),p=l({mobile:{display:"inherit",visibility:"visible"},tablet:{display:"inherit",visibility:"visible"},desktop:{display:"none",visibility:"hidden"}})},49187:function(e,n,t){"use strict";t.d(n,{f:function(){return r}});var i=t(28165);function r(e){return(0,i.iv)("grid-area:",e,";","[filename]--[local]")}},15666:function(e,n,t){"use strict";var i=t(92228);function r(){var e=(0,i.Z)(["\n fragment AppConnection on AppConnection {\n banner\n canConnect\n id\n slug\n selectedApi\n title\n images {\n url128X128\n url64X64\n url32X32\n url16X16\n }\n hasStaleAuth\n }\n"]);return r=function(){return e},e}var o=(0,t(60138).Ps)(r());n.Z=o},9562:function(e,n,t){"use strict";t.d(n,{I:function(){return w},Z:function(){return A}});var i,r=t(70865),o=t(96670),a=t(50930),s=t(2784),l=t(40794),c=t(86692),u=t(64368);!function(e){e[e.empty=0]="empty",e[e.initial=1]="initial",e[e.loaded=2]="loaded",e[e.more=3]="more"}(i||(i={}));var d=function(e){switch(e){case u.I.loading:case u.I.setVariables:case u.I.refetch:return i.initial;case u.I.fetchMore:case u.I.poll:return i.more;case u.I.ready:return i.loaded}return i.empty},p=t(92228),v=t(60138),f=t(15666);function h(){var e=(0,p.Z)(["\n ","\n\n query GetAppConnections(\n $offset: Int!\n $limit: Int!\n $isPrivate: Boolean\n $owner: ID\n $isShared: Boolean\n $title: String\n ) {\n appConnections(\n offset: $offset\n limit: $limit\n isPrivate: $isPrivate\n owner: $owner\n isShared: $isShared\n title: $title\n ) {\n totalCount\n pageInfo {\n count\n hasNextPage\n }\n edges {\n ...AppConnection\n canConnect\n }\n }\n }\n"]);return h=function(){return e},e}var g=(0,v.Ps)(h(),f.Z),m=t(38017);function b(){var e=(0,p.Z)(["\n query GetCustomAppCount {\n appConnections(offset: 0, limit: 1, isPrivate: true) {\n totalCount\n }\n }\n"]);return b=function(){return e},e}var Z=(0,v.Ps)(b()),y=function(e){var n,t=e.skip,i=(0,l.a)(Z,{skip:t}),r=i.data,o=i.loading;return{count:(null===r||void 0===r||null===(n=r.appConnections)||void 0===n?void 0:n.totalCount)||0,isLoading:o||!1}},x=t(16181),w=20,A=function(e){var n,t,i,u,p,v,f,h=e||{},b=h.page,Z=void 0===b?0:b,A=h.search,S=void 0===A?"":A,C=h.selectedFilter,I=h.skipAppSearchRecommendations,k=(0,x.gn)(),L=k.isTeam,P=k.userId,T="private"===C,z=function(e){var n=e.selectedFilter,t=void 0===n?"myApps":n,i=e.page,r=void 0===i?0:i,o=e.limit,a=void 0===o?w:o,s=e.userId,l=e.search,c=void 0===l?"":l,u=e.isPrivate;return{isShared:"sharedWithMe"===t||null,limit:a,offset:r*a,owner:"myApps"===t&&s||null,title:c,isPrivate:void 0!==u&&u}}({page:Z,search:S,userId:P,selectedFilter:C}),_=y({skip:L}),F=(0,l.a)(g,{skip:T||!P,variables:z}),M=(0,l.a)(g,{skip:!(!C||T)||!P,variables:(0,o.Z)((0,r.Z)({},z),{isPrivate:!0})}),B=(0,m.Z)(I?"":S),N=(null===(n=M.data)||void 0===n||null===(t=n.appConnections)||void 0===t?void 0:t.totalCount)||0,q=((null===(i=F.data)||void 0===i||null===(u=i.appConnections)||void 0===u?void 0:u.totalCount)||0)+N,$=(0,c.e$)(F.error||M.error),X=(0,s.useMemo)((function(){var e,n,t,i,s=(null===F||void 0===F||null===(e=F.data)||void 0===e||null===(n=e.appConnections)||void 0===n?void 0:n.edges)||[],l=(null===M||void 0===M||null===(t=M.data)||void 0===t||null===(i=t.appConnections)||void 0===i?void 0:i.edges)||[];return(0,a.Z)(s.map((function(e){return(0,o.Z)((0,r.Z)({},e),{isPrivate:!1})}))).concat((0,a.Z)(l.map((function(e){return(0,o.Z)((0,r.Z)({},e),{isPrivate:!0})}))))}),[F,M]),E=(0,s.useCallback)((function(){var e,n,t,i,s,l,c=T?M:F,u=(null===c||void 0===c||null===(e=c.data)||void 0===e||null===(n=e.appConnections)||void 0===n||null===(t=n.edges)||void 0===t?void 0:t.length)||0;return c.loading||!(null===c||void 0===c||null===(i=c.data)||void 0===i||null===(s=i.appConnections)||void 0===s||null===(l=s.pageInfo)||void 0===l?void 0:l.hasNextPage)?null:c.fetchMore({updateQuery:function(e,n){var t=n.fetchMoreResult;if(!t)return e;var i=e.appConnections.edges||[],s=t.appConnections.edges||[];return(0,o.Z)((0,r.Z)({},t),{appConnections:(0,o.Z)((0,r.Z)({},t.appConnections),{edges:(0,a.Z)(i).concat((0,a.Z)(s))})})},variables:{offset:u}})}),[T,M,F]),U=Boolean(null===(p=(T?M:F).data)||void 0===p||null===(v=p.appConnections)||void 0===v||null===(f=v.pageInfo)||void 0===f?void 0:f.hasNextPage);return{appAlternatives:null===B||void 0===B?void 0:B.results,connections:X,count:q,error:$,hasMoreApps:U,hasPrivate:_.count>0,isAltLoading:(null===B||void 0===B?void 0:B.isLoading)||(null===B||void 0===B?void 0:B.isPrivateLoading),isLoading:M.loading||F.loading,onLoadMoreApps:E,pageCount:Math.ceil(q/w),pageSize:w,privateLoadingState:d(M.networkStatus),publicLoadingState:d(F.networkStatus)}}},38017:function(e,n,t){"use strict";t.d(n,{Z:function(){return h}});var i=t(50930),r=t(40794),o=t(2784),a=t(92228),s=t(60138),l=t(15666);function c(){var e=(0,a.Z)(["\n fragment App on App {\n categories {\n id\n name\n }\n canConnect\n currentImplementationId\n currentImplementationMeta {\n authType\n hasUpfrontFields\n id\n }\n description\n id\n image\n name\n primaryColor\n slug\n }\n"]);return c=function(){return e},e}var u=(0,s.Ps)(c());function d(){var e=(0,a.Z)(["\n ","\n\n query AppSearch($nameContains: String!) {\n appsByNameContains(nameContains: $nameContains) {\n edges {\n ...App\n }\n }\n }\n"]);return d=function(){return e},e}function p(){var e=(0,a.Z)(["\n ","\n\n query PrivateAppSearch($nameContains: String!) {\n privateAppConnections(nameContains: $nameContains) {\n edges {\n ...AppConnection\n currentImplementationMeta {\n authType\n hasUpfrontFields\n id\n }\n canConnect\n }\n }\n }\n"]);return p=function(){return e},e}var v=(0,s.Ps)(d(),u),f=(0,s.Ps)(p(),l.Z),h=function(e){var n=(0,r.a)(v,{variables:{nameContains:e},skip:!e.length}),t=(0,r.a)(f,{variables:{nameContains:e},skip:!e.length}),a=(0,o.useMemo)((function(){var e,t;return((null===n||void 0===n||null===(e=n.data)||void 0===e||null===(t=e.appsByNameContains)||void 0===t?void 0:t.edges)||[]).filter((function(e){return e.canConnect}))}),[n]),s=(0,o.useMemo)((function(){var e,n;return((null===t||void 0===t||null===(e=t.data)||void 0===e||null===(n=e.privateAppConnections)||void 0===n?void 0:n.edges)||[]).filter((function(e){return e.canConnect}))}),[t]);return{results:(0,o.useMemo)((function(){return(0,i.Z)(a).concat((0,i.Z)(s))}),[a,s]),isLoading:n.loading,isPrivateLoading:t.loading}}},50293:function(e,n,t){"use strict";t.d(n,{Z:function(){return y}});var i=t(98788),r=t(5163),o=t(2784),a=t(38716),s=t(47842),l=t(96459),c=t(9197),u=t(59251),d=function(){return new Promise((function(e,n){var t,i=window.location.origin,r=function(e){return window.open(e,"_blank","height=700,width=980,scrollbars=yes")}((t="/window-splash/",(0,u.v)("csrftoken")?t:(0,l.Sr)("/csrf/fix/",{next:t})));if(r){var o=function(n){n.origin===i&&"ready"===n.data&&(window.removeEventListener("message",o),e(r))};window.addEventListener("message",o,!1)}else n(new Error("Popup was blocked."))}))},p="_zapier_auth_id",v="authenticationSuccess",f="AUTH_FAILED_CONN",h=function(e,n){var t=new Error(n);return t.code=e,t},g=function(e){return(0,c.uz)(function(e){var n,t=e.serviceKey,i=e.accountId,r=e.isShared,o=e.authId,a=e.authIdentifier,c=e.destinationServiceKey,u=e.isForSignup;return(0,l.Sr)("/engine/auth/start/".concat(t,"/"),(n={},(0,s.Z)(n,"_zapier_account_id",i),(0,s.Z)(n,"_zapier_is_shared",r),(0,s.Z)(n,p,o),(0,s.Z)(n,"_zapier_expected_identifier",a),(0,s.Z)(n,"_zapier_destination_selected_api",c),(0,s.Z)(n,"for_signup",u),n),!0)}(e)).then((function(e){return e.url}))},m=function(e,n){return new Promise((function(t,i){var r,o=window.location.origin,a=!1,s=function(e){e.origin===o&&e.data.type===v&&(r=e.data.authId,a=!0)};window.addEventListener("message",s);var l=function(){e.closed?setTimeout((function(){window.removeEventListener("message",s),a&&(null!=r||n)||i(h(f,"Failed to connect account.")),t(r)}),0):setTimeout(l,1e3)};l()}))},b=function(){var e=(0,i.Z)((function(e){var n,t,i,o,a,c,u,v,f,b,Z,y,x,w,A,S,C,I,k;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return n=e.accountId,t=e.hasUpfrontFields,i=e.isShared,o=e.isOauth,a=e.serviceKey,c=e.authId,u=e.authIdentifier,v=e.destinationServiceKey,f=e.onError,b=void 0===f?function(){}:f,Z=e.onTrack,y=void 0===Z?function(){return Promise.resolve()}:Z,x=e.isForSignup,w={accountId:n,isShared:i,serviceKey:a,authId:c,authIdentifier:u,destinationServiceKey:v,isForSignup:x},[4,d()];case 1:return A=r.sent(),[4,g(w)];case 2:S=r.sent(),C=function(e,n,t,i){var r;return!t||i?(0,l.Sr)(e,(r={},(0,s.Z)(r,"isShared",n.isShared),(0,s.Z)(r,p,n.authId),r),!0):e}(S,w,o,t),y("auth: redirect to first leg",{accountId:n,authId:c,isForSignup:x,isOauth:o,parameterizedUrl:C,serviceKey:a});try{A.location=C}catch(L){throw b(L),h("AUTH_POPUP_FAILURE","Could not change the popup location.")}r.label=3;case 3:return r.trys.push([3,5,,6]),[4,m(A,o)];case 4:return I=r.sent(),y("auth: connection success",{accountId:n,authId:c,conn:I,isForSignup:x,isOauth:o,parameterizedUrl:C,serviceKey:a}),[2,I];case 5:throw k=r.sent(),y("auth: could not get connection",{accountId:n,authId:c,error:k.message,isForSignup:x,isOauth:o,parameterizedUrl:C,serviceKey:a}),k;case 6:return[2]}}))}));return function(n){return e.apply(this,arguments)}}(),Z=t(53736),y=function(){var e=(0,a.X8)(),n=(0,Z.l)().createNotification,t=(0,o.useCallback)(function(){var t=(0,i.Z)((function(t,i){var o,a,s,l,c;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!(null===t||void 0===t?void 0:t.canConnect))throw new Error("".concat(null===t||void 0===t?void 0:t.name," does not require connections"));return[4,b({accountId:e,authId:null===i||void 0===i?void 0:i.id,authIdentifier:(null===i||void 0===i?void 0:i.identifier)||void 0,destinationServiceKey:(null===i||void 0===i?void 0:i.destinationSelectedApi)||void 0,hasUpfrontFields:Boolean(null===t||void 0===t||null===(o=t.currentImplementationMeta)||void 0===o?void 0:o.hasUpfrontFields),isOauth:"oauth"===(null===(a=t.currentImplementationMeta)||void 0===a?void 0:a.authType),isShared:(null===i||void 0===i?void 0:i.isShared)||void 0,serviceKey:(null===(s=t.currentImplementationMeta)||void 0===s?void 0:s.id)||t.selectedApi||void 0})];case 1:return l=r.sent(),[2,{app:t,connection:i,id:l}];case 2:return(null===(c=r.sent())||void 0===c?void 0:c.code)!==f&&n({message:c.toString(),type:"error"}),[3,3];case 3:return[2,{app:t,connection:i}]}}))}));return function(e,n){return t.apply(this,arguments)}}(),[e,n]);return t}},57037:function(e,n,t){"use strict";var i=t(2784);n.Z=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,t=(0,i.useState)(e),r=t[0],o=t[1];return(0,i.useEffect)((function(){var t=setTimeout((function(){o(e)}),n);return function(){clearTimeout(t)}}),[n,e]),r}}},function(e){e.O(0,[3153,9774,2888,179],(function(){return n=98571,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
//# sourceMappingURL=connections-02762e0ae33eb013.js.map