PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/notifications-1125467609773afd.js

js lidomatrip.com collected 2026-09-25 07:12:13 UTC 19,072 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8769],{72038:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/notifications",function(){return n(62047)}])},49378:function(t,e,n){"use strict";n.d(e,{TH:function(){return c},aK:function(){return h},aZ:function(){return m},pd:function(){return v},tn:function(){return l}});var i=n(47568),r=n(26042),s=n(70655),a=n(57149),o=function(t){return null==t?void 0:t.data};function c(t){return u.apply(this,arguments)}function u(){return(u=(0,i.Z)(function(t){var e;return(0,s.__generator)(this,function(n){switch(n.label){case 0:return[4,a.Z.setUrl("/api/notifications").setCallMethod("GET").setParams((0,r.Z)({},t.archived?{archived:"true"}:{},t.cursor?{cursor:t.cursor}:{},t.take?{take:t.take}:{})).call()];case 1:return[2,null!==(e=o(n.sent()))&&void 0!==e?e:{items:[],next_cursor:null}]}})})).apply(this,arguments)}function l(){return d.apply(this,arguments)}function d(){return(d=(0,i.Z)(function(){var t,e;return(0,s.__generator)(this,function(n){switch(n.label){case 0:return[4,a.Z.setUrl("/api/notifications/unread-count").setCallMethod("GET").call()];case 1:return[2,null!==(e=null===(t=o(n.sent()))||void 0===t?void 0:t.count)&&void 0!==e?e:0]}})})).apply(this,arguments)}function h(t){return f.apply(this,arguments)}function f(){return(f=(0,i.Z)(function(t){var e,n;return(0,s.__generator)(this,function(i){switch(i.label){case 0:return[4,a.Z.setUrl("/api/notifications/read").setCallMethod("POST").setBody((null==t?void 0:t.length)?{ids:t}:{}).call()];case 1:return[2,null!==(n=null===(e=o(i.sent()))||void 0===e?void 0:e.updated)&&void 0!==n?n:0]}})})).apply(this,arguments)}function m(t){return x.apply(this,arguments)}function x(){return(x=(0,i.Z)(function(t){var e,n=arguments;return(0,s.__generator)(this,function(i){return e=!(n.length>1)||void 0===n[1]||n[1],[2,a.Z.setUrl("/api/notifications/".concat(t,"/archive")).setCallMethod("POST").setBody({archived:e}).call()]})})).apply(this,arguments)}function v(){return g.apply(this,arguments)}function g(){return(g=(0,i.Z)(function(){var t,e;return(0,s.__generator)(this,function(n){switch(n.label){case 0:return[4,a.Z.setUrl("/api/notifications/archive-all").setCallMethod("POST").setBody({}).call()];case 1:return[2,null!==(e=null===(t=o(n.sent()))||void 0===t?void 0:t.updated)&&void 0!==e?e:0]}})})).apply(this,arguments)}},47416:function(t,e,n){"use strict";var i=n(85893);n(67294),e.Z=function(t){var e=t.icon,n=t.title,r=t.containerClassname,s=t.element,a=t.asH1;return(0,i.jsxs)("div",{className:"flex items-center justify-between ".concat(r||""),children:[(0,i.jsxs)("div",{className:"flex items-center",children:[!!e&&(0,i.jsx)("div",{className:"flex items-center ml-12",children:e}),a?(0,i.jsx)("h1",{className:"text-[#000000] text-16 leading-28 font-m",children:n}):(0,i.jsx)("h2",{className:"text-[#000000] text-16 leading-28 font-m",children:n})]}),s]})}},5518:function(t,e,n){"use strict";var i=n(85893),r=n(47300),s=n(82941);e.Z=function(t){var e=t.title,n=t.subTitle,a=t.onRetry,o=t.isRetrying;return(0,i.jsx)(s.Z,{iconSrc:(0,i.jsx)("i",{"aria-hidden":"true",className:"icon-Warning text-56 text-warning"}),title:void 0===e?"اطلاعات بارگذاری نشد":e,subTitle:void 0===n?"ارتباط برقرار نشد. دوباره تلاش کنید.":n,containerClassname:"py-40",actions:(0,i.jsx)("div",{className:"flex justify-center",children:(0,i.jsx)(r.z,{variant:"outlined",color:"black",onClick:a,isLoading:o,loadingText:"در حال تلاش…",rightIcon:(0,i.jsx)("i",{"aria-hidden":"true",className:"icon-Refresh text-20"}),children:"تلاش دوباره"})})})}},86757:function(t,e,n){"use strict";var i=n(85893);e.Z=function(t){var e=t.widthClass,n=t.heightClass;return(0,i.jsx)("div",{className:"\n        skeleton-shimmer\n        ".concat(e||"w-48","\n        ").concat(n||"h-48","\n      "),children:(0,i.jsx)("div",{className:"\n            w-full h-full\n            bg-gray-E9EdF1\n            rounded-full\n      "})})}},2195:function(t,e,n){"use strict";var i=n(85893);e.Z=function(t){var e=t.widthClass,n=t.heightClass,r=t.borderRadiusClass,s=t.marginsClassnames,a=t.extraClassnames;return(0,i.jsx)("div",{className:"\n        skeleton-shimmer\n        ".concat(e||"w-48","\n        ").concat(n||"h-48","\n        ").concat(s||"","\n        ").concat(a||"","\n    "),children:(0,i.jsx)("div",{className:"\n              w-full h-full\n              bg-gray-E9EdF1\n              ".concat(r||"rounded-8","\n        ")})})}},44824:function(t,e,n){"use strict";n.d(e,{r:function(){return s}});var i=n(85893),r=n(67294),s=function(t){var e,n,s,a=t.checked,o=t.onChange,c=t.disabled,u=t.label,l=t.labelClassnames,d=t.inputClassnames,h=t.name,f=t.wrapperClassnames,m=t.formik,x=(0,r.useRef)(null);return(0,i.jsxs)("div",{className:"\n        flex items-center gap-x-8\n        ".concat(c?"cursor-not-allowed":"cursor-pointer","\n        ").concat(f||"","\n      "),children:[u&&(0,i.jsx)("div",{className:"text-14 leading-24 text-black font-r ".concat(l||""),children:u}),(0,i.jsxs)("div",{className:"relative w-40 h-24 rounded-50 transition-all ".concat(m&&(null===(e=m.values)||void 0===e?void 0:e[h])||a?d||"bg-primary-main":"bg-gradient-to-b from-[rgba(25,59,103,0.05)] to-[rgba(25,59,103,0.05)] bg-white"),onClick:function(t){if(!c){var e,n;null===(e=null==x?void 0:x.current)||void 0===e||null===(n=e.click)||void 0===n||n.call(e)}},children:[(0,i.jsx)("input",{name:h,type:"checkbox",id:"toggleB",checked:m?!!(null==m?void 0:null===(n=m.values)||void 0===n?void 0:n[h]):a,onChange:function(t){m?m.setFieldValue(h,t.target.checked):o&&o(t)},hidden:!0,ref:x}),(0,i.jsx)("div",{className:"\n            absolute w-20 h-20 bg-white shadow-[0px_0px_4px_rgba(0,0,0,0.16)] rounded-full top-2\n            ".concat(m&&(null===(s=m.values)||void 0===s?void 0:s[h])||a?"right-2":"left-2","\n          ")})]})]})}},27230:function(t,e,n){"use strict";n.d(e,{Z:function(){return c}});var i=n(85893),r=n(41664),s=n.n(r),a={BOOKING_REQUESTED:{icon:"icon-Reserve",tone:"text-primary-main"},BOOKING_NEW_REQUEST:{icon:"icon-Reserve",tone:"text-primary-main"},BOOKING_APPROVED:{icon:"icon-Success",tone:"text-success"},BOOKING_COMPLETED:{icon:"icon-Success",tone:"text-success"},BOOKING_REJECTED:{icon:"icon-Error",tone:"text-error-light"},BOOKING_CANCELLED:{icon:"icon-Error",tone:"text-error-light"},BOOKING_EXPIRED:{icon:"icon-Calendar",tone:"text-gray-959FA7"},REVIEW_RECEIVED:{icon:"icon-Comments",tone:"text-black"},MESSAGE_RECEIVED:{icon:"icon-message",tone:"text-black"},RESIDENCE_PUBLISHED:{icon:"icon-AddHome",tone:"text-success"},RESIDENCE_REJECTED:{icon:"icon-AddHome",tone:"text-error-light"},ACCOUNT_VERIFIED:{icon:"icon-Profile",tone:"text-success"},PAYMENT_APPROVED:{icon:"icon-Wallet",tone:"text-success"},PAYMENT_REJECTED:{icon:"icon-Wallet",tone:"text-error-light"}},o={icon:"icon-Bell",tone:"text-gray-959FA7"},c=function(t){var e,n=t.notification,r=t.onArchive,c=t.onRead,u=null!==(e=a[n.kind])&&void 0!==e?e:o,l=u.icon,d=u.tone,h=!n.is_read,f=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"mt-2 flex h-40 w-40 shrink-0 items-center justify-center rounded-full bg-gray-F5F5F7 ".concat(d),children:(0,i.jsx)("i",{"aria-hidden":"true",className:"".concat(l," text-20")})}),(0,i.jsxs)("span",{className:"min-w-0 grow",children:[(0,i.jsxs)("span",{className:"mb-4 flex items-center gap-x-8",children:[(0,i.jsx)("span",{className:"text-14 leading-20 font-m text-black",children:n.title}),h&&(0,i.jsx)("span",{className:"h-8 w-8 shrink-0 rounded-full bg-primary-main","aria-hidden":"true"}),(0,i.jsx)("span",{className:"mr-auto shrink-0 text-11 leading-16 font-r text-gray-959FA7",children:function(t){var e=new Date(t).getTime();if(Number.isNaN(e))return"";var n=Math.floor((Date.now()-e)/1e3),i=function(t){return Math.floor(t).toLocaleStr
1ing("fa-IR")};return n<60?"همین حالا":n<3600?"".concat(i(n/60)," دقیقه پیش"):n<86400?"".concat(i(n/3600)," ساعت پیش"):n<604800?"".concat(i(n/86400)," روز پیش"):new Intl.DateTimeFormat("fa-IR",{day:"numeric",month:"long",year:"numeric"}).format(new Date(t))}(n.created_at)})]}),(0,i.jsx)("span",{className:"block text-13 leading-22 font-r text-gray-6C6A7D",children:n.body}),h&&(0,i.jsx)("span",{className:"sr-only",children:"خوانده نشده"})]})]}),m="flex grow items-start gap-x-12 rounded-16 p-14 transition-transform duration-150 ease-out active:scale-[0.99] ".concat(h?"bg-primary-main bg-opacity-[4%]":"");return(0,i.jsxs)("div",{className:"group flex items-start gap-x-4 rounded-16 border-1 border-solid bg-white ".concat(h?"border-primary-main border-opacity-30 shadow-[0_1px_3px_rgba(24,39,58,0.06)]":"border-gray-F0F0F0"),children:[n.link_url?(0,i.jsx)(s(),{href:n.link_url,prefetch:!1,onClick:function(){return h&&(null==c?void 0:c(n.id))},className:"".concat(m," grow hover:bg-gray-F5F5F7 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-main"),children:f}):(0,i.jsx)("div",{className:"".concat(m," grow"),children:f}),r&&(0,i.jsx)("button",{type:"button","aria-label":"بایگانی \xab".concat(n.title,"\xbb"),onClick:function(){return r(n.id)},className:"mt-12 shrink-0 rounded-8 p-8 text-gray-959FA7 transition-colors hover:bg-gray-F5F5F7 hover:text-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-main",children:(0,i.jsx)("i",{"aria-hidden":"true",className:"icon-Hide text-18"})})]})}},62047:function(t,e,n){"use strict";n.r(e),n.d(e,{__N_SSP:function(){return C},default:function(){return w}});var i=n(85893),r=n(26042),s=n(69396),a=n(10253),o=n(67294),c=n(85945),u=n(59403),l=n(48228),d=n(22920),h=n(49378),f=n(47416),m=n(44824),x=n(47300),v=n(82941),g=n(5518),p=n(2195),b=n(86757);function y(){return(0,i.jsxs)("div",{className:"flex items-start gap-x-4 border-b-1 border-solid border-gray-EFEFEF px-12 py-14 last:border-b-0",children:[(0,i.jsx)("div",{className:"mt-2 shrink-0",children:(0,i.jsx)(b.Z,{widthClass:"w-40",heightClass:"h-40"})}),(0,i.jsxs)("div",{className:"min-w-0 grow pr-8",children:[(0,i.jsxs)("div",{className:"mb-8 flex items-center gap-x-8",children:[(0,i.jsx)(p.Z,{widthClass:"w-[45%]",heightClass:"h-14",borderRadiusClass:"rounded-6"}),(0,i.jsx)(p.Z,{widthClass:"w-40",heightClass:"h-10",borderRadiusClass:"rounded-6",marginsClassnames:"mr-auto"})]}),(0,i.jsx)(p.Z,{widthClass:"w-[85%]",heightClass:"h-12",borderRadiusClass:"rounded-6"})]})]})}var N=function(t){var e=t.rows;return(0,i.jsx)("div",{"aria-hidden":"true",className:"rounded-16 border-1 border-solid border-gray-EFEFEF bg-white p-8",children:Array.from({length:void 0===e?6:e}).map(function(t,e){return(0,i.jsx)(y,{},e)})})},E=n(27230),j=function(){var t,e,n=(0,c.NL)(),p=(0,a.Z)((0,o.useState)(!1),2),b=p[0],y=p[1],j=(0,u.N)({queryKey:["notifications",b],queryFn:function(t){var e=t.pageParam;return(0,h.TH)({archived:b,cursor:e,take:20})},getNextPageParam:function(e){return null!==(t=e.next_cursor)&&void 0!==t?t:void 0},keepPreviousData:!0}),C=j.data,w=j.isLoading,R=j.isFetchingNextPage,_=j.hasNextPage,k=j.fetchNextPage,F=j.isError,O=j.isFetching,P=j.refetch,M=(0,o.useMemo)(function(){return null!==(e=null==C?void 0:C.pages.flatMap(function(t){return t.items}))&&void 0!==e?e:[]},[C]),Z=M.filter(function(t){return!t.is_read}).length,D=(0,o.useCallback)(function(){n.invalidateQueries({queryKey:["notifications"]}),n.invalidateQueries({queryKey:["notificationsUnread"]})},[n]),S=(0,l.D)({mutationFn:function(){return(0,h.aK)()},onSuccess:D,onError:function(){return d.Am.error("انجام نشد. دوباره تلاش کنید.")}}),T=(0,o.useCallback)(function(t){var e=["notifications",b],i=n.getQueryData(e);return n.setQueryData(e,function(e){return e?(0,s.Z)((0,r.Z)({},e),{pages:e.pages.map(function(e){return(0,s.Z)((0,r.Z)({},e),{items:t(e.items)})})}):e}),function(){return n.setQueryData(e,i)}},[n,b]),A=(0,l.D)({mutationFn:function(t){return(0,h.aK)([t])},onMutate:function(t){return T(function(e){return e.map(function(e){return e.id===t?(0,s.Z)((0,r.Z)({},e),{is_read:!0}):e})})},onError:function(t,e,n){return null==n?void 0:n()},onSuccess:D}),I=(0,l.D)({mutationFn:function(t){return(0,h.aZ)(t,!b)},onMutate:function(t){return T(function(e){return e.filter(function(e){return e.id!==t})})},onError:function(t,e,n){null==n||n(),d.Am.error("انجام نشد. دوباره تلاش کنید.")},onSuccess:D}),B=(0,l.D)({mutationFn:function(){return(0,h.pd)()},onSuccess:D,onError:function(){return d.Am.error("انجام نشد. دوباره تلاش کنید.")}});return(0,i.jsxs)("div",{className:"pb-40",children:[(0,i.jsx)(f.Z,{title:"اعلانات",icon:(0,i.jsx)("i",{"aria-hidden":"true",className:"icon-Bell text-24"}),containerClassname:"mb-16"}),(0,i.jsxs)("div",{className:"mb-16 flex items-center justify-between rounded-12 bg-gray-F8F8F8 px-14 py-10",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-13 leading-20 font-m text-black",children:"نمایش بایگانی‌شده‌ها"}),(0,i.jsx)("p",{className:"mt-2 text-11 leading-18 font-r text-gray-77828F",children:b?"اعلان‌های بایگانی‌شده":"فقط اعلان‌های جاری"})]}),(0,i.jsx)(m.r,{name:"show-archived",checked:b,onChange:function(t){return y(t.target.checked)}})]}),!b&&M.length>0&&(0,i.jsxs)("div",{className:"mb-12 flex items-center justify-end gap-x-4",children:[Z>
10&&(0,i.jsx)("button",{type:"button",onClick:function(){return S.mutate()},disabled:S.isLoading,className:"rounded-8 px-10 py-6 text-13 leading-20 font-r text-primary-main transition-colors hover:bg-gray-F5F5F7 disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-main",children:"خواندن همه"}),(0,i.jsx)("button",{type:"button",onClick:function(){return B.mutate()},disabled:B.isLoading,className:"rounded-8 px-10 py-6 text-13 leading-20 font-r text-gray-6C6A7D transition-colors hover:bg-gray-F5F5F7 hover:text-black disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-main",children:"بایگانی همه"})]}),w?(0,i.jsx)(N,{}):F?(0,i.jsx)(g.Z,{title:"اعلان‌ها بارگذاری نشد",onRetry:function(){P()},isRetrying:O}):0===M.length?(0,i.jsx)(v.Z,{title:b?"اعلان بایگانی‌شده‌ای ندارید":"هنوز اعلانی برایتان نیامده",iconSrc:"/assets/No-notif.svg",containerClassname:"py-[40px]"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"flex flex-col gap-y-8",children:M.map(function(t){return(0,i.jsx)(E.Z,{notification:t,onRead:function(t){return A.mutate(t)},onArchive:function(t){return I.mutate(t)}},t.id)})}),_&&(0,i.jsx)(x.z,{className:"mt-24",isFullWidth:!0,variant:"outlined",color:"black",isLoading:R,loadingText:"در حال دریافت",onClick:function(){return k()},children:"نمایش بیشتر"})]})]})},C=!0,w=function(){return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(j,{})})}},59403:function(t,e,n){"use strict";n.d(e,{N:function(){return c}});var i=n(32161),r=n(52924),s=n(9499);class a extends r.z{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t,e){super.setOptions({...t,behavior:(0,s.Gm)()},e)}getOptimisticResult(t){return t.behavior=(0,s.Gm)(),super.getOptimisticResult(t)}fetchNextPage({pageParam:t,...e}={}){return this.fetch({...e,meta:{fetchMore:{direction:"forward",pageParam:t}}})}fetchPreviousPage({pageParam:t,...e}={}){return this.fetch({...e,meta:{fetchMore:{direction:"backward",pageParam:t}}})}createResult(t,e){var n,i,r,a,o,c;let{state:u}=t,l=super.createResult(t,e),{isFetching:d,isRefetching:h}=l,f=d&&(null==(n=u.fetchMeta)?void 0:null==(i=n.fetchMore)?void 0:i.direction)==="forward",m=d&&(null==(r=u.fetchMeta)?void 0:null==(a=r.fetchMore)?void 0:a.direction)==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,s.Qy)(e,null==(o=u.data)?void 0:o.pages),hasPreviousPage:(0,s.ZF)(e,null==(c=u.data)?void 0:c.pages),isFetchingNextPage:f,isFetchingPreviousPage:m,isRefetching:h&&!f&&!m}}}var o=n(67187);function c(t,e,n){let r=(0,i._v)(t,e,n);return(0,o.r)(r,a)}},48228:function(t,e,n){"use strict";n.d(e,{D:function(){return h}});var i=n(67294),r=n(464),s=n(32161),a=n(89886),o=n(30081),c=n(33989);class u extends c.l{constructor(t,e){super(),this.client=t,this.setOptions(e),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var e;let n=this.options;this.options=this.client.defaultMutationOptions(t),(0,s.VS)(n,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),null==(e=this.currentMutation)||e.setOptions(this.options)}onUnsubscribe(){if(!this.listeners.length){var t;null==(t=this.currentMutation)||t.removeObserver(this)}}onMutationUpdate(t){this.updateResult();let e={listeners:!0};"success"===t.type?e.onSuccess=!0:"error"===t.type&&(e.onError=!0),this.notify(e)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(t,e){return this.mutateOptions=e,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:void 0!==t?t:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){let t=this.currentMutation?this.currentMutation.state:(0,a.R)(),e={...t,isLoading:"loading"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset};this.currentResult=e}notify(t){o.V.batch(()=>
1{if(this.mutateOptions&&this.hasListeners()){var e,n,i,r,s,a,o,c;t.onSuccess?(null==(e=(n=this.mutateOptions).onSuccess)||e.call(n,this.currentResult.data,this.currentResult.variables,this.currentResult.context),null==(i=(r=this.mutateOptions).onSettled)||i.call(r,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)):t.onError&&(null==(s=(a=this.mutateOptions).onError)||s.call(a,this.currentResult.error,this.currentResult.variables,this.currentResult.context),null==(o=(c=this.mutateOptions).onSettled)||o.call(c,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context))}t.listeners&&this.listeners.forEach(t=>{t(this.currentResult)})})}}var l=n(85945),d=n(24798);function h(t,e,n){let a=(0,s.lV)(t,e,n),c=(0,l.NL)({context:a.context}),[h]=i.useState(()=>new u(c,a));i.useEffect(()=>{h.setOptions(a)},[h,a]);let m=(0,r.$)(i.useCallback(t=>h.subscribe(o.V.batchCalls(t)),[h]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x=i.useCallback((t,e)=>{h.mutate(t,e).catch(f)},[h]);if(m.error&&(0,d.L)(h.options.useErrorBoundary,[m.error]))throw m.error;return{...m,mutate:x,mutateAsync:m.mutate}}function f(){}}},function(t){t.O(0,[9774,2888,179],function(){return t(t.s=72038)}),_N_E=t.O()}]);

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