"use strict";(self.webpackChunklite=self.webpackChunklite||[]).push([[2648],{11818:(e,a,n)=>{n.d(a,{j:()=>c});var t=n(45458),i=n(6925),d={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"CatalogAddToListItem_catalog"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Catalog"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"predefined"}},{kind:"Field",name:{kind:"Name",value:"version"}},{kind:"FragmentSpread",name:{kind:"Name",value:"WithToggleInsideCatalog_catalog"}}]}}].concat((0,t.A)(i.C.definitions))},o={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"CatalogAddToList_catalog"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Catalog"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"CatalogAddToListItem_catalog"}}]}}].concat((0,t.A)(d.definitions))},l=n(13397),r={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"YourCatalogs_catalog"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Catalog"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"FragmentSpread",name:{kind:"Name",value:"CatalogsListItem_catalog"}}]}}].concat((0,t.A)(l.m.definitions))},m={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"GetCatalogsByUserReadingList_catalog"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Catalog"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"CatalogAddToList_catalog"},directives:[{kind:"Directive",name:{kind:"Name",value:"skip"},arguments:[{kind:"Argument",name:{kind:"Name",value:"if"},value:{kind:"Variable",name:{kind:"Name",value:"withCatalogDetails"}}}]}]},{kind:"FragmentSpread",name:{kind:"Name",value:"YourCatalogs_catalog"},directives:[{kind:"Directive",name:{kind:"Name",value:"include"},arguments:[{kind:"Argument",name:{kind:"Name",value:"if"},value:{kind:"Variable",name:{kind:"Name",value:"withCatalogDetails"}}}]}]}]}}].concat((0,t.A)(o.definitions),(0,t.A)(r.definitions))},s={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"GetCatalogsByUserCatalogs_catalog"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Catalog"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"CatalogAddToList_catalog"},directives:[{kind:"Directive",name:{kind:"Name",value:"skip"},arguments:[{kind:"Argument",name:{kind:"Name",value:"if"},value:{kind:"Variable",name:{kind:"Name",value:"withCatalogDetails"}}}]}]},{kind:"FragmentSpread",name:{kind:"Name",value:"YourCatalogs_catalog"},directives:[{kind:"Directive",name:{kind:"Name",value:"include"},arguments:[{kind:"Argument",name:{kind:"Name",value:"if"},value:{kind:"Variable",name:{kind:"Name",value:"withCatalogDetails"}}}]}]}]}}].concat((0,t.A)(o.definitions),(0,t.A)(r.definitions))},c={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetCatalogsByUserQuery"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pagingOptions"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CatalogPagingOptionsInput"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"type"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CatalogType"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"withCatalogDetails"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:{kind:"Name",value:"readingList"},name:{kind:"Name",value:"getPredefinedCatalog"},arguments:[{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}},{kind:"Argument",name:{kind:"Name",value:"type"},value:{kind:"EnumValue",value:"READING_LIST"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"FragmentSpread",name:{kind:"Name",value:"GetCatalogsByUserReadingList_catalog"}}]}},{kind:"Field",name:{kind:"Name",value:"catalogsByUser"},arguments:[{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}},{kind:"Argument",name:{kind:"Name",value:"pagingOptions"},value:{kind:"Variable",name:{kind:"Name",value:"pagingOptions"}}},{kind:"Argument",name:{kind:"Name",value:"type"},value:{kind:"Variable",name:{kind:"Name",value:"type"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"Field",name:{kind:"Name",value:"catalogs"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"GetCatalogsByUserCatalogs_catalog"}}]}},{kind:"Field",name:{kind:"Name",value:"paging"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"Field",name:{kind:"Name",value:"nextPageCursor"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]}}]}}].concat((0,t.A)(m.definitions),(0,t.A)(s.definitions))}},86595:(e,a,n)=>{n.d(a,{a:()=>y});var t=n(80296),i=n(96540),d=n(41370),o=n(85764),l=n(97213),r=n(5521),m=n(64314),s=n(52290),c=n(46844),u=n(86527),g=n(53424),k=n(39410),p=n(36557),v=n(42976),f=n(91830),I=n(39160),C=n(46879),N="creatListModal";function y(e){var a=e.isVisible,n=e.hide,y=e.target,S=e.kind,b=e.viewer,h=i.useState(""),T=(0,t.A)(h,2),_=T[0],A=T[1],E=i.useState(!1),D=(0,t.A)(E,2),F=D[0],O=D[1],w=i.useState(""),L=(0,t.A)(w,2),V=L[0],P=L[1],B=i.useState(!1),R=(0,t.A)(B,2),j=R[0],x=R[1],M=(0,I.d4)((function(e){return e.config.authDomain})),G=(0,l.u4)(b.id),U=G.createCatalog,Y=G.loading,$=G.data,q=G.error,K=(0,r.Ku)(),W=(0,f.zF)();i.useEffect((function(){if("Catalog"===(null==$?void 0:$.createCatalog.__typename))if(S&&y){var e=$.createCatalog,a=e.id,n=e.version;K({userId:b.id,catalogId:a,version:n,kind:S,itemId:y.id}),z()}else window.location.assign((0,C.n1u)($.createCatalog,M))}),[null==$?void 0:$.createCatalog,S,null==y?void 0:y.id,K,b.id]),i.useEffect((function(){q&&W({toastStyle:"RETRYABLE_ERROR",duration:4e3})}),[q,W]);var X=i.useCallback((function(e){A(e.target.value)}),[A]),H=i.useCallback((function(e){P(e.target.value)}),[P]),z=i.useCallback((function(){A(""),P(""),O(!1),x(!1),n()}),[n]),J=i.useCallback((function(){var e=_.trim();e.length>0&&U({attributes:{title:e,description:V.trim(),type:v.Mh.LISTS,visibility:j?v.y_.PRIVATE:v.y_.PUBLIC}})}),[_,V,j,U]);return i.createElement(m.m,{isVisible:a,hide:z,confirmText:i.createElement(d.G,{loading:Y,text:"Create"}),isDestructiveAction:!1,onConfirm:J,disableConfirm:!_.trim()||Y||(0,o.dX)(_)||(0,o.JX)(V),hideOnConfirm:!1,testId:N},i.createElement(s.a,{height:"400px"},i.createElement(s.a,{paddingBottom:"60px"},i.createElement(k.hE,{scale:"L",testId:"".concat(N,"Title")},"Create new list")),i.createElement(s.a,{textAlign:"left",width:"400px",sm:{width:"100%"}},i.createElement(s.a,{paddingBottom:"20px"},i.createElement(c.A,{value:_,onChange:X,placeholder:"Give it a name",characterCountLimit:o.OW,testId:"".concat(N,"Input")})),i.createElement(s.a,{paddingBottom:"20px"},F?i.createElement(s.a,{maxHeight:"170px",overflow:"auto"},i.createElement(c.A,{value:V,onChange:H,placeholder:"Description",isMultiline:!0,autoFocus:!0,characterCountLimit:o.Ke})):i.createElement(u.N,{onClick:function(){return O(!0)},"data-testid":"".concat(N,"AddDescriptionButton")},i.createElement(p.kZ,{scale:"L",color:"ACCENT"},"Add a description"))),i.createElement(s.a,null,i.createElement(g.S,{checked:j,onChange:function(){return x(!j)},textScale:"L",testId:"".concat(N,"MakePrivateCheckbox")},"Make it private")))))}},5521:(e,a,n)=>{n.d(a,{$O:()=>N,EH:()=>C,Ku:()=>I,Xj:()=>f,pj:()=>S,ue:()=>v});var t=n(64467),i=n(80296),d=n(88055),o=n.n(d),l=n(95420),r=n(96540),m=n(678),s=n(72130),c=n(42976),u=n(97249),g=n(37561);function k(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function p(e){for(var a=1;a1?o.event("list.itemsDeleted",{listId:a,itemsCount:n}):t[0].entityType===c.Bd.POST&&o.event("post.removeFromList",{listId:a,postId:t[0].entityId})}}})};function y(e){var a,n,i,d=e.cache,l=e.result,r=e.catalogId,s=e.viewerId,k=e.itemId,v=e.kind,f=e.operation,I=e.predefined,C=e.deletedCatalogItemIds,N=null===(a=l.data)||void 0===a?void 0:a.editCatalogItems;if("EditCatalogItemsSuccess"===(null==N?void 0:N.__typename)&&((0,m.eq)(d,r,N.version),v===c.Bd.POST)){n=(0,u.N)(k,s),"PostViewerEdge",i=g.t;var y="".concat("PostViewerEdge",":").concat(n),S=d.readFragment({id:y,fragment:i});if(null!=S&&S.catalogsConnection){var b=N.operations,h=N.version,T=b[0];if(!T||"move"===f)return;var _=o()(I?S.catalogsConnection.predefinedContainingThis:S.catalogsConnection.catalogsContainingThis),A=_.findIndex((function(e){return I?e.predefined===I:e.catalogId===r}));if("append"===f||"preprend"===f){var E=T[f];if(-1!==A)_[A].catalogItemIds.push(E.catalogItemId);else{var D={catalogId:r,version:h,catalogItemIds:[E.catalogItemId]};I&&(D.predefined=I),_.push(D)}}else if("delete"===f&&-1!==A&&C){var F=_[A].catalogItemIds;_[A].catalogItemIds=F.filter((function(e){return!C.includes(e)})),0===_[A].catalogItemIds.length&&_.splice(A,1)}d.writeFragment({id:y,fragment:i,data:p(p({},S),{},{catalogsConnection:p(p({},null==S?void 0:S.catalogsConnection),{},(0,t.A)({},I?"predefinedContainingThis":"catalogsContainingThis",_))})})}}}function S(e,a,n,t){return(0,l.n)(g.u,{variables:{catalogId:e,version:a,operations:n},update:function(a){(0,m.Tq)(a,e)},onCompleted:t})}},97249:(e,a,n)=>{function t(e,a){return"postId:".concat(e,"-viewerId:").concat(a)}n.d(a,{N:()=>t})}}]); //# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/2648.26563adf.chunk.js.map