@articles-media/articles-dev-box 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Ad.cjs +1 -1
- package/dist/Ad.js +199 -195
- package/dist/FriendsList.cjs +1 -1
- package/dist/FriendsList.js +16 -14
- package/dist/GameScoreboard.cjs +1 -1
- package/dist/GameScoreboard.js +45 -37
- package/dist/ReturnToLauncherButton.cjs +1 -1
- package/dist/ReturnToLauncherButton.js +19 -14
- package/package.json +1 -1
package/dist/Ad.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),o=require("react"),v=require("./numberWithCommas-CRgrb58X.cjs"),E=require("./index-Ddv_TnxK.cjs"),Q=require("./Button-0ZK0NKiK.cjs"),Y=require("./index-BlP2-uOi.cjs");function Z(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:()=>s[i]})}}return t.default=s,Object.freeze(t)}const _=Z(o);var P=new Map,S=new WeakMap,B=0,ee;function se(s){return s?(S.has(s)||(B+=1,S.set(s,B.toString())),S.get(s)):"0"}function te(s){return Object.keys(s).sort().filter(t=>s[t]!==void 0).map(t=>`${t}_${t==="root"?se(s.root):s[t]}`).toString()}function ne(s){const t=te(s);let i=P.get(t);if(!i){const r=new Map;let a;const x=new IntersectionObserver(p=>{p.forEach(c=>{var u;const R=c.isIntersecting&&a.some(f=>c.intersectionRatio>=f);s.trackVisibility&&typeof c.isVisible>"u"&&(c.isVisible=R),(u=r.get(c.target))==null||u.forEach(f=>{f(R,c)})})},s);a=x.thresholds||(Array.isArray(s.threshold)?s.threshold:[s.threshold||0]),i={id:t,observer:x,elements:r},P.set(t,i)}return i}function re(s,t,i={},r=ee){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const u=s.getBoundingClientRect();return t(r,{isIntersecting:r,target:s,intersectionRatio:typeof i.threshold=="number"?i.threshold:0,time:0,boundingClientRect:u,intersectionRect:u,rootBounds:u}),()=>{}}const{id:a,observer:x,elements:p}=ne(i),c=p.get(s)||[];return p.has(s)||p.set(s,c),c.push(t),x.observe(s),function(){c.splice(c.indexOf(t),1),c.length===0&&(p.delete(s),x.unobserve(s)),p.size===0&&(x.disconnect(),P.delete(a))}}function ie({threshold:s,delay:t,trackVisibility:i,rootMargin:r,root:a,triggerOnce:x,skip:p,initialInView:c,fallbackInView:u,onChange:R}={}){var f;const[n,d]=_.useState(null),k=_.useRef(R),N=_.useRef(c),[y,I]=_.useState({inView:!!c,entry:void 0});k.current=R,_.useEffect(()=>{if(N.current===void 0&&(N.current=c),p||!n)return;let j;return j=re(n,(w,A)=>{const D=N.current;N.current=w,!(D===void 0&&!w)&&(I({inView:w,entry:A}),k.current&&k.current(w,A),A.isIntersecting&&x&&j&&(j(),j=void 0))},{root:a,rootMargin:r,threshold:s,trackVisibility:i,delay:t},u),()=>{j&&j()}},[Array.isArray(s)?s.toString():s,n,a,r,x,p,i,u,t]);const g=(f=y.entry)==null?void 0:f.target,M=_.useRef(void 0);!n&&g&&!x&&!p&&M.current!==g&&(M.current=g,I({inView:!!c,entry:void 0}),N.current=c);const m=[d,y.inView,y.entry];return m.ref=m[0],m.inView=m[1],m.entry=m[2],m}const oe=async s=>{if(process.env.NODE_ENV==="development")try{return(await E.axios.get(`http://localhost:3001/api/ads/${s.ad_id}`,{params:{ad_id:s.ad_id,user_ad_token:s.user_ad_token}})).data.result}catch{}return E.axios.get(s.url,{params:{ad_id:s.ad_id}}).then(t=>t.data.result)},ae=60,ce={dedupingInterval:1e3*60*ae},le=(s,t)=>{const{data:i,error:r,isLoading:a,mutate:x}=E.useSWR(s?{url:`https://articles.media/api/ads/${s}`,ad_id:s,user_ad_token:t}:null,oe,ce);return{data:i,error:r,isLoading:a,mutate:x}};function de(s){return t=>{const r=(s?Math[s]:Math.trunc)(t);return r===0?0:r}}function ue(s,t){return+v.toDate(s)-+v.toDate(t)}function W(s,t,i){const r=ue(s,t)/v.millisecondsInMinute;return de(i?.roundingMethod)(r)}function z(s){return Math.trunc(s*v.millisecondsInMinute)}const xe=async s=>{if(process.env.NODE_ENV==="development")try{return(await E.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return E.axios.get(s.url,{params:{}}).then(t=>t.data)},U=60,me={dedupingInterval:z(U),focusThrottleInterval:z(U)},pe=s=>{const{data:t,error:i,isLoading:r,mutate:a}=E.useSWR(s?.loading||s?.disabled?null:{url:"https://articles.media/api/ads"},xe,me);return{data:t,error:i,isLoading:r,mutate:a}},fe=o.lazy(()=>Promise.resolve().then(()=>require("./AdDetailsModal-k840vrS2.cjs"))),je=o.lazy(()=>Promise.resolve().then(()=>require("./AdConfirmExitModal-CcSxmXKT.cjs")));function he(s,t){return Math.floor(Math.random()*(t-s+1))+s}function ve(s){let{previewMode:t,darkMode:i,user_ad_token:r,userDetails:a,userDetailsLoading:x}=s;const p=!1,c=[],[u,R]=o.useState(null),{data:f}=pe({loading:x,disabled:a?.articles_membership?.status=="Active"}),{data:n}=le(u,r);let d=s.previewData||{};const[k,N]=o.useState(null),[y,I]=o.useState(null),[g,M]=o.useState(null),[m,j]=o.useState(0),[w,A]=o.useState(!1),[D,$]=o.useState(!1),[X,L]=o.useState(!1),[Ee,Re]=o.useState(new Date),[O,K]=o.useState([]);o.useEffect(()=>{f&&f?.length>0&&!u&&(console.log("Ad Mounted or reduxAds changed"),R(s.ad_id||f[he(0,f?.length-1)]?._id))},[f]),o.useEffect(()=>{},[n]),o.useEffect(()=>{n?.populated_promos&&m>=0&&M(n?.populated_promos[m])},[m,n]);function F(){$(!D)}const{ref:G,inView:b}=ie({threshold:0,triggerOnce:!0});function V(l){if(t&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),O.find(h=>h==l)){console.log("Already logged this event");return}E.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:l}}).then(function(h){K([...O,l]),console.log(h.data)}).catch(function(h){console.log(h)})}o.useEffect(()=>{if(!t&&(console.log("inView",b),b&&u)){let l=[{ad_id:u,date:new Date().toString()},...c.filter(h=>{if(console.log(W(new Date,new Date(h.date))),W(new Date,new Date(h.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),h})];console.log("unexpiredRecentViews",l)}},[b,u]);const[T,H]=o.useState(null),[J,C]=o.useState(!1);function q(){C(!0),console.log("logAdAvoided called",r),E.axios.get(process.env.NODE_ENV==="development"?"http://localhost:3001/api/user/advertising/avoided":"https://articles.media/api/user/advertising/avoided",{params:{user_id:a?._id},headers:{"x-articles-api-key":r}}).then(function(l){C(!1),H(l.data.avoided_count),console.log(l.data)}).catch(function(l){console.log(l),C(!1)})}return o.useEffect(()=>{t||(console.log("inView",b),a?.articles_membership?.status=="Active"&&b&&q())},[b,a]),x?null:e.jsxRuntimeExports.jsxs("div",{ref:G,className:Y.classNames("ad-wrap",{"active-member":a?.articles_membership?.status=="Active"}),style:{"--articles-ad-background-color":d.background_color||n?.background_color,"--articles-ad-font-color":d.font_color||n?.font_color,"--articles-ad-border-color":d.border_color||n?.border_color},children:[D&&e.jsxRuntimeExports.jsx(fe,{setModalShow:$,ad:n,previewData:d}),X&&e.jsxRuntimeExports.jsx(je,{setModalShow:L,ad:n,previewData:d}),e.jsxRuntimeExports.jsxs("div",{className:"ad",children:[a?.articles_membership?.status!=="Active"&&e.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:e.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo",children:(d.logo?.location||n?.logo?.location)&&e.jsxRuntimeExports.jsx("img",{src:d?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${d?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),e.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),e.jsxRuntimeExports.jsx("img",{className:"photo",src:d?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${d.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:d?.business||n?.business})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),e.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),e.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&e.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),e.jsxRuntimeExports.jsx("div",{className:"short-description",children:d?.description||n?.description})]})]}),p?.roles?.isDev&&n?.populated_promos?.length>0&&e.jsxRuntimeExports.jsxs("div",{children:[g&&e.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:g&&e.jsxRuntimeExports.jsxs("div",{className:"promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("div",{children:g.title}),e.jsxRuntimeExports.jsx("div",{className:"small",children:e.jsxRuntimeExports.jsx("div",{className:"small",children:g.details})})]}),e.jsxRuntimeExports.jsx(Q.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),A(!0)},children:"Save"})]},g._id)}),e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),e.jsxRuntimeExports.jsxs("div",{className:"controls",children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{m==0?j(n?.populated_promos?.length-1):j(l=>l-1)}}),n?.populated_promos?.map((l,h)=>e.jsxRuntimeExports.jsx("i",{className:`fa-square ${h==m?"fad":"fas"}`},l._id)),e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{m==n?.populated_promos?.length-1?j(0):j(l=>l+1)}})]})]})]}),e.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),e.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[e.jsxRuntimeExports.jsx("div",{onClick:()=>{F(),V("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),e.jsxRuntimeExports.jsx("span",{className:"px-4"}),e.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:l=>{l.preventDefault(),L(!0),V("Confirm Exit Modal Opened")},children:e.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]}),a?.articles_membership?.status=="Active"&&e.jsxRuntimeExports.jsx("div",{className:"main-panel",children:e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo"}),e.jsxRuntimeExports.jsxs("div",{className:"splash",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-broadcast-tower"}),e.jsxRuntimeExports.jsxs("div",{className:"text",children:[e.jsxRuntimeExports.jsx("div",{className:"count",children:J?e.jsxRuntimeExports.jsx("i",{className:"fas fa-spinner fa-spin me-0"}):T?v.numberWithCommas(T):0}),e.jsxRuntimeExports.jsx("div",{className:"label",children:"ads avoided."})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"member-since",children:["Member since: ",e.jsxRuntimeExports.jsx(v.ArticlesDate,{format:"PP",date:a?.articles_membership?.membership_started})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsx("div",{className:"detail-title",children:e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:"Thanks for the support!"})})}),e.jsxRuntimeExports.jsxs("div",{className:"short-description",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-2",children:"Without support from users like you, we wouldn't be here."}),e.jsxRuntimeExports.jsxs("div",{className:"links-list",children:[e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/messages",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-comments-alt"}),"0 unread messages."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/notifications",onClick:()=>{q()},children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-bell"}),"0 notifications."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/account",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-cog"}),"Manage account settings."]})]})]})]})]})})]}),!t&&e.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:d.background_color||n?.background_color,color:d.font_color||n?.font_color,borderColor:d.border_color||n?.border_color},children:e.jsxRuntimeExports.jsxs(v.Link,{className:"small d-block w-100 text-center",href:"https://articles.media/advertising",newPage:!0,children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const ge=o.memo(ve);module.exports=ge;
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),c=require("react"),v=require("./numberWithCommas-CRgrb58X.cjs"),R=require("./index-Ddv_TnxK.cjs"),Z=require("./Button-0ZK0NKiK.cjs"),ee=require("./index-BlP2-uOi.cjs");function se(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:()=>s[i]})}}return t.default=s,Object.freeze(t)}const A=se(c);var C=new Map,M=new WeakMap,W=0,te;function ne(s){return s?(M.has(s)||(W+=1,M.set(s,W.toString())),M.get(s)):"0"}function re(s){return Object.keys(s).sort().filter(t=>s[t]!==void 0).map(t=>`${t}_${t==="root"?ne(s.root):s[t]}`).toString()}function ie(s){const t=re(s);let i=C.get(t);if(!i){const r=new Map;let l;const u=new IntersectionObserver(x=>{x.forEach(o=>{var p;const N=o.isIntersecting&&l.some(j=>o.intersectionRatio>=j);s.trackVisibility&&typeof o.isVisible>"u"&&(o.isVisible=N),(p=r.get(o.target))==null||p.forEach(j=>{j(N,o)})})},s);l=u.thresholds||(Array.isArray(s.threshold)?s.threshold:[s.threshold||0]),i={id:t,observer:u,elements:r},C.set(t,i)}return i}function oe(s,t,i={},r=te){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const p=s.getBoundingClientRect();return t(r,{isIntersecting:r,target:s,intersectionRatio:typeof i.threshold=="number"?i.threshold:0,time:0,boundingClientRect:p,intersectionRect:p,rootBounds:p}),()=>{}}const{id:l,observer:u,elements:x}=ie(i),o=x.get(s)||[];return x.has(s)||x.set(s,o),o.push(t),u.observe(s),function(){o.splice(o.indexOf(t),1),o.length===0&&(x.delete(s),u.unobserve(s)),x.size===0&&(u.disconnect(),C.delete(l))}}function ae({threshold:s,delay:t,trackVisibility:i,rootMargin:r,root:l,triggerOnce:u,skip:x,initialInView:o,fallbackInView:p,onChange:N}={}){var j;const[_,b]=A.useState(null),n=A.useRef(N),a=A.useRef(o),[k,D]=A.useState({inView:!!o,entry:void 0});n.current=N,A.useEffect(()=>{if(a.current===void 0&&(a.current=o),x||!_)return;let g;return g=oe(_,(f,E)=>{const P=a.current;a.current=f,!(P===void 0&&!f)&&(D({inView:f,entry:E}),n.current&&n.current(f,E),E.isIntersecting&&u&&g&&(g(),g=void 0))},{root:l,rootMargin:r,threshold:s,trackVisibility:i,delay:t},p),()=>{g&&g()}},[Array.isArray(s)?s.toString():s,_,l,r,u,x,i,p,t]);const y=(j=k.entry)==null?void 0:j.target,S=A.useRef(void 0);!_&&y&&!u&&!x&&S.current!==y&&(S.current=y,D({inView:!!o,entry:void 0}),a.current=o);const m=[b,k.inView,k.entry];return m.ref=m[0],m.inView=m[1],m.entry=m[2],m}const ce=async s=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get(`http://localhost:3001/api/ads/${s.ad_id}`,{params:{ad_id:s.ad_id,user_ad_token:s.user_ad_token}})).data.result}catch{}return R.axios.get(s.url,{params:{ad_id:s.ad_id}}).then(t=>t.data.result)},le=60,de={dedupingInterval:1e3*60*le},ue=(s,t)=>{const{data:i,error:r,isLoading:l,mutate:u}=R.useSWR(s?{url:`https://articles.media/api/ads/${s}`,ad_id:s,user_ad_token:t}:null,ce,de);return{data:i,error:r,isLoading:l,mutate:u}};function xe(s){return t=>{const r=(s?Math[s]:Math.trunc)(t);return r===0?0:r}}function me(s,t){return+v.toDate(s)-+v.toDate(t)}function z(s,t,i){const r=me(s,t)/v.millisecondsInMinute;return xe(i?.roundingMethod)(r)}function U(s){return Math.trunc(s*v.millisecondsInMinute)}const pe=async s=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return R.axios.get(s.url,{params:{}}).then(t=>t.data)},X=60,je={dedupingInterval:U(X),focusThrottleInterval:U(X)},fe=s=>{const{data:t,error:i,isLoading:r,mutate:l}=R.useSWR(s?.loading||s?.disabled?null:{url:"https://articles.media/api/ads"},pe,je);return{data:t,error:i,isLoading:r,mutate:l}},he=c.lazy(()=>Promise.resolve().then(()=>require("./AdDetailsModal-k840vrS2.cjs"))),ve=c.lazy(()=>Promise.resolve().then(()=>require("./AdConfirmExitModal-CcSxmXKT.cjs")));function ge(s,t){return Math.floor(Math.random()*(t-s+1))+s}function Ee(s){let{previewMode:t,darkMode:i,user_ad_token:r,userDetails:l,userDetailsLoading:u,prepend:x,append:o}=s;const p=!1,N=[],[j,_]=c.useState(null),{data:b}=fe({loading:u,disabled:l?.articles_membership?.status=="Active"}),{data:n}=ue(j,r);let a=s.previewData||{};const[k,D]=c.useState(null),[y,S]=c.useState(null),[m,g]=c.useState(null),[f,E]=c.useState(0),[P,K]=c.useState(!1),[$,L]=c.useState(!1),[F,O]=c.useState(!1),[Ne,be]=c.useState(new Date),[V,G]=c.useState([]);c.useEffect(()=>{b&&b?.length>0&&!j&&(console.log("Ad Mounted or reduxAds changed"),_(s.ad_id||b[ge(0,b?.length-1)]?._id))},[b]),c.useEffect(()=>{},[n]),c.useEffect(()=>{n?.populated_promos&&f>=0&&g(n?.populated_promos[f])},[f,n]);function H(){L(!$)}const{ref:J,inView:w}=ae({threshold:0,triggerOnce:!0});function T(d){if(t&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),V.find(h=>h==d)){console.log("Already logged this event");return}R.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:d}}).then(function(h){G([...V,d]),console.log(h.data)}).catch(function(h){console.log(h)})}c.useEffect(()=>{if(!t&&(console.log("inView",w),w&&j)){let d=[{ad_id:j,date:new Date().toString()},...N.filter(h=>{if(console.log(z(new Date,new Date(h.date))),z(new Date,new Date(h.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),h})];console.log("unexpiredRecentViews",d)}},[w,j]);const[q,Q]=c.useState(null),[Y,I]=c.useState(!1);function B(){I(!0),console.log("logAdAvoided called",r),R.axios.get(process.env.NODE_ENV==="development"?"http://localhost:3001/api/user/advertising/avoided":"https://articles.media/api/user/advertising/avoided",{params:{user_id:l?._id},headers:{"x-articles-api-key":r}}).then(function(d){I(!1),Q(d.data.avoided_count),console.log(d.data)}).catch(function(d){console.log(d),I(!1)})}return c.useEffect(()=>{t||(console.log("inView",w),l?.articles_membership?.status=="Active"&&w&&B())},[w,l]),u?null:e.jsxRuntimeExports.jsxs("div",{ref:J,className:ee.classNames("ad-wrap",{"active-member":l?.articles_membership?.status=="Active"}),style:{"--articles-ad-background-color":a.background_color||n?.background_color,"--articles-ad-font-color":a.font_color||n?.font_color,"--articles-ad-border-color":a.border_color||n?.border_color},children:[$&&e.jsxRuntimeExports.jsx(he,{setModalShow:L,ad:n,previewData:a}),F&&e.jsxRuntimeExports.jsx(ve,{setModalShow:O,ad:n,previewData:a}),x&&e.jsxRuntimeExports.jsx("div",{className:"prepend-container",children:x}),e.jsxRuntimeExports.jsxs("div",{className:"ad",children:[l?.articles_membership?.status!=="Active"&&e.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:e.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo",children:(a.logo?.location||n?.logo?.location)&&e.jsxRuntimeExports.jsx("img",{src:a?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${a?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),e.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),e.jsxRuntimeExports.jsx("img",{className:"photo",src:a?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${a.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:a?.business||n?.business})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),e.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),e.jsxRuntimeExports.jsxs("div",{className:"detail",children:[e.jsxRuntimeExports.jsx("span",{className:"icon",children:e.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),e.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&e.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),e.jsxRuntimeExports.jsx("div",{className:"short-description",children:a?.description||n?.description})]})]}),p?.roles?.isDev&&n?.populated_promos?.length>0&&e.jsxRuntimeExports.jsxs("div",{children:[m&&e.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:m&&e.jsxRuntimeExports.jsxs("div",{className:"promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("div",{children:m.title}),e.jsxRuntimeExports.jsx("div",{className:"small",children:e.jsxRuntimeExports.jsx("div",{className:"small",children:m.details})})]}),e.jsxRuntimeExports.jsx(Z.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),K(!0)},children:"Save"})]},m._id)}),e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),e.jsxRuntimeExports.jsxs("div",{className:"controls",children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{f==0?E(n?.populated_promos?.length-1):E(d=>d-1)}}),n?.populated_promos?.map((d,h)=>e.jsxRuntimeExports.jsx("i",{className:`fa-square ${h==f?"fad":"fas"}`},d._id)),e.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{f==n?.populated_promos?.length-1?E(0):E(d=>d+1)}})]})]})]}),e.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),e.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[e.jsxRuntimeExports.jsx("div",{onClick:()=>{H(),T("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),e.jsxRuntimeExports.jsx("span",{className:"px-4"}),e.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:d=>{d.preventDefault(),O(!0),T("Confirm Exit Modal Opened")},children:e.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]}),l?.articles_membership?.status=="Active"&&e.jsxRuntimeExports.jsx("div",{className:"main-panel",children:e.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[e.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[e.jsxRuntimeExports.jsx("div",{className:"logo"}),e.jsxRuntimeExports.jsxs("div",{className:"splash",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-broadcast-tower"}),e.jsxRuntimeExports.jsxs("div",{className:"text",children:[e.jsxRuntimeExports.jsx("div",{className:"count",children:Y?e.jsxRuntimeExports.jsx("i",{className:"fas fa-spinner fa-spin me-0"}):q?v.numberWithCommas(q):0}),e.jsxRuntimeExports.jsx("div",{className:"label",children:"ads avoided."})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"member-since",children:["Member since: ",e.jsxRuntimeExports.jsx(v.ArticlesDate,{format:"PP",date:l?.articles_membership?.membership_started})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[e.jsxRuntimeExports.jsx("div",{className:"detail-title",children:e.jsxRuntimeExports.jsx("div",{className:"detail",children:e.jsxRuntimeExports.jsx("span",{className:"h4",children:"Thanks for the support!"})})}),e.jsxRuntimeExports.jsxs("div",{className:"short-description",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-2",children:"Without support from users like you, we wouldn't be here."}),e.jsxRuntimeExports.jsxs("div",{className:"links-list",children:[e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/messages",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-comments-alt"}),"0 unread messages."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/notifications",onClick:()=>{B()},children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-bell"}),"0 notifications."]}),e.jsxRuntimeExports.jsxs(v.Link,{newPage:!0,className:"link-item",href:"https://articles.media/settings/account",children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-cog"}),"Manage account settings."]})]})]})]})]})})]}),o&&e.jsxRuntimeExports.jsx("div",{className:"append-container",children:o}),!t&&e.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:a.background_color||n?.background_color,color:a.font_color||n?.font_color,borderColor:a.border_color||n?.border_color},children:e.jsxRuntimeExports.jsxs(v.Link,{className:"small d-block w-100 text-center",href:"https://articles.media/advertising",newPage:!0,children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const Re=c.memo(Ee);module.exports=Re;
|
package/dist/Ad.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-tc70JA_2.js";
|
|
2
|
-
import * as
|
|
3
|
-
import { lazy as
|
|
4
|
-
import { t as
|
|
5
|
-
import { u as
|
|
6
|
-
import { A as
|
|
7
|
-
import { c as
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
return s ? (
|
|
2
|
+
import * as A from "react";
|
|
3
|
+
import { lazy as G, memo as re, useState as p, useEffect as y } from "react";
|
|
4
|
+
import { t as X, m as H, n as ne, A as ie, L as E } from "./numberWithCommas-DnAkiOFL.js";
|
|
5
|
+
import { u as J, a as k } from "./index-DLYx67wi.js";
|
|
6
|
+
import { A as oe } from "./Button-_Quon8UV.js";
|
|
7
|
+
import { c as le } from "./index-YnD2EP-S.js";
|
|
8
|
+
var S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), z = 0, de;
|
|
9
|
+
function ce(s) {
|
|
10
|
+
return s ? (I.has(s) || (z += 1, I.set(s, z.toString())), I.get(s)) : "0";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function ue(s) {
|
|
13
13
|
return Object.keys(s).sort().filter(
|
|
14
14
|
(t) => s[t] !== void 0
|
|
15
|
-
).map((t) => `${t}_${t === "root" ?
|
|
15
|
+
).map((t) => `${t}_${t === "root" ? ce(s.root) : s[t]}`).toString();
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const t =
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
17
|
+
function me(s) {
|
|
18
|
+
const t = ue(s);
|
|
19
|
+
let l = S.get(t);
|
|
20
|
+
if (!l) {
|
|
21
21
|
const r = /* @__PURE__ */ new Map();
|
|
22
|
-
let
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
s.trackVisibility && typeof
|
|
28
|
-
|
|
22
|
+
let o;
|
|
23
|
+
const c = new IntersectionObserver((u) => {
|
|
24
|
+
u.forEach((n) => {
|
|
25
|
+
var h;
|
|
26
|
+
const N = n.isIntersecting && o.some((f) => n.intersectionRatio >= f);
|
|
27
|
+
s.trackVisibility && typeof n.isVisible > "u" && (n.isVisible = N), (h = r.get(n.target)) == null || h.forEach((f) => {
|
|
28
|
+
f(N, n);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
31
|
}, s);
|
|
32
|
-
|
|
32
|
+
o = c.thresholds || (Array.isArray(s.threshold) ? s.threshold : [s.threshold || 0]), l = {
|
|
33
33
|
id: t,
|
|
34
|
-
observer:
|
|
34
|
+
observer: c,
|
|
35
35
|
elements: r
|
|
36
|
-
},
|
|
36
|
+
}, S.set(t, l);
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return l;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function he(s, t, l = {}, r = de) {
|
|
41
41
|
if (typeof window.IntersectionObserver > "u" && r !== void 0) {
|
|
42
|
-
const
|
|
42
|
+
const h = s.getBoundingClientRect();
|
|
43
43
|
return t(r, {
|
|
44
44
|
isIntersecting: r,
|
|
45
45
|
target: s,
|
|
46
|
-
intersectionRatio: typeof
|
|
46
|
+
intersectionRatio: typeof l.threshold == "number" ? l.threshold : 0,
|
|
47
47
|
time: 0,
|
|
48
|
-
boundingClientRect:
|
|
49
|
-
intersectionRect:
|
|
50
|
-
rootBounds:
|
|
48
|
+
boundingClientRect: h,
|
|
49
|
+
intersectionRect: h,
|
|
50
|
+
rootBounds: h
|
|
51
51
|
}), () => {
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const { id:
|
|
55
|
-
return
|
|
56
|
-
|
|
54
|
+
const { id: o, observer: c, elements: u } = me(l), n = u.get(s) || [];
|
|
55
|
+
return u.has(s) || u.set(s, n), n.push(t), c.observe(s), function() {
|
|
56
|
+
n.splice(n.indexOf(t), 1), n.length === 0 && (u.delete(s), c.unobserve(s)), u.size === 0 && (c.disconnect(), S.delete(o));
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function fe({
|
|
60
60
|
threshold: s,
|
|
61
61
|
delay: t,
|
|
62
|
-
trackVisibility:
|
|
62
|
+
trackVisibility: l,
|
|
63
63
|
rootMargin: r,
|
|
64
|
-
root:
|
|
65
|
-
triggerOnce:
|
|
66
|
-
skip:
|
|
67
|
-
initialInView:
|
|
68
|
-
fallbackInView:
|
|
69
|
-
onChange:
|
|
64
|
+
root: o,
|
|
65
|
+
triggerOnce: c,
|
|
66
|
+
skip: u,
|
|
67
|
+
initialInView: n,
|
|
68
|
+
fallbackInView: h,
|
|
69
|
+
onChange: N
|
|
70
70
|
} = {}) {
|
|
71
|
-
var
|
|
72
|
-
const [
|
|
73
|
-
inView: !!
|
|
71
|
+
var f;
|
|
72
|
+
const [_, b] = A.useState(null), a = A.useRef(N), i = A.useRef(n), [M, C] = A.useState({
|
|
73
|
+
inView: !!n,
|
|
74
74
|
entry: void 0
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
a.current = N, A.useEffect(
|
|
77
77
|
() => {
|
|
78
|
-
if (
|
|
79
|
-
let
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
(
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
inView:
|
|
86
|
-
entry:
|
|
87
|
-
}),
|
|
78
|
+
if (i.current === void 0 && (i.current = n), u || !_) return;
|
|
79
|
+
let x;
|
|
80
|
+
return x = he(
|
|
81
|
+
_,
|
|
82
|
+
(v, j) => {
|
|
83
|
+
const $ = i.current;
|
|
84
|
+
i.current = v, !($ === void 0 && !v) && (C({
|
|
85
|
+
inView: v,
|
|
86
|
+
entry: j
|
|
87
|
+
}), a.current && a.current(v, j), j.isIntersecting && c && x && (x(), x = void 0));
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
root:
|
|
90
|
+
root: o,
|
|
91
91
|
rootMargin: r,
|
|
92
92
|
threshold: s,
|
|
93
93
|
// @ts-expect-error
|
|
94
|
-
trackVisibility:
|
|
94
|
+
trackVisibility: l,
|
|
95
95
|
delay: t
|
|
96
96
|
},
|
|
97
|
-
|
|
97
|
+
h
|
|
98
98
|
), () => {
|
|
99
|
-
|
|
99
|
+
x && x();
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
102
|
// We break the rule here, because we aren't including the actual `threshold` variable
|
|
@@ -104,28 +104,28 @@ function me({
|
|
|
104
104
|
[
|
|
105
105
|
// If the threshold is an array, convert it to a string, so it won't change between renders.
|
|
106
106
|
Array.isArray(s) ? s.toString() : s,
|
|
107
|
-
|
|
108
|
-
n,
|
|
109
|
-
r,
|
|
110
|
-
u,
|
|
111
|
-
f,
|
|
107
|
+
_,
|
|
112
108
|
o,
|
|
109
|
+
r,
|
|
113
110
|
c,
|
|
111
|
+
u,
|
|
112
|
+
l,
|
|
113
|
+
h,
|
|
114
114
|
t
|
|
115
115
|
]
|
|
116
116
|
);
|
|
117
|
-
const
|
|
118
|
-
!
|
|
119
|
-
inView: !!
|
|
117
|
+
const D = (f = M.entry) == null ? void 0 : f.target, R = A.useRef(void 0);
|
|
118
|
+
!_ && D && !c && !u && R.current !== D && (R.current = D, C({
|
|
119
|
+
inView: !!n,
|
|
120
120
|
entry: void 0
|
|
121
|
-
}),
|
|
122
|
-
const m = [
|
|
121
|
+
}), i.current = n);
|
|
122
|
+
const m = [b, M.inView, M.entry];
|
|
123
123
|
return m.ref = m[0], m.inView = m[1], m.entry = m[2], m;
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const pe = async (s) => {
|
|
126
126
|
if (process.env.NODE_ENV === "development")
|
|
127
127
|
try {
|
|
128
|
-
return (await
|
|
128
|
+
return (await k.get(`http://localhost:3001/api/ads/${s.ad_id}`, {
|
|
129
129
|
params: {
|
|
130
130
|
ad_id: s.ad_id,
|
|
131
131
|
user_ad_token: s.user_ad_token
|
|
@@ -133,213 +133,216 @@ const fe = async (s) => {
|
|
|
133
133
|
})).data.result;
|
|
134
134
|
} catch {
|
|
135
135
|
}
|
|
136
|
-
return
|
|
136
|
+
return k.get(s.url, {
|
|
137
137
|
params: {
|
|
138
138
|
ad_id: s.ad_id
|
|
139
139
|
}
|
|
140
140
|
}).then((t) => t.data.result);
|
|
141
|
-
},
|
|
142
|
-
dedupingInterval: 1e3 * 60 *
|
|
141
|
+
}, ve = 60, ge = {
|
|
142
|
+
dedupingInterval: 1e3 * 60 * ve
|
|
143
143
|
// keepPreviousData: true,
|
|
144
144
|
// fallbackData: []
|
|
145
|
-
},
|
|
146
|
-
const { data:
|
|
145
|
+
}, xe = (s, t) => {
|
|
146
|
+
const { data: l, error: r, isLoading: o, mutate: c } = J(
|
|
147
147
|
s ? {
|
|
148
148
|
url: `https://articles.media/api/ads/${s}`,
|
|
149
149
|
ad_id: s,
|
|
150
150
|
user_ad_token: t
|
|
151
151
|
} : null,
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
pe,
|
|
153
|
+
ge
|
|
154
154
|
);
|
|
155
155
|
return {
|
|
156
|
-
data:
|
|
156
|
+
data: l,
|
|
157
157
|
error: r,
|
|
158
|
-
isLoading:
|
|
159
|
-
mutate:
|
|
158
|
+
isLoading: o,
|
|
159
|
+
mutate: c
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
|
-
function
|
|
162
|
+
function je(s) {
|
|
163
163
|
return (t) => {
|
|
164
164
|
const r = (s ? Math[s] : Math.trunc)(t);
|
|
165
165
|
return r === 0 ? 0 : r;
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
return +
|
|
168
|
+
function Ne(s, t) {
|
|
169
|
+
return +X(s) - +X(t);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
const r =
|
|
173
|
-
return
|
|
171
|
+
function q(s, t, l) {
|
|
172
|
+
const r = Ne(s, t) / H;
|
|
173
|
+
return je(l?.roundingMethod)(r);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return Math.trunc(s *
|
|
175
|
+
function K(s) {
|
|
176
|
+
return Math.trunc(s * H);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const be = async (s) => {
|
|
179
179
|
if (process.env.NODE_ENV === "development")
|
|
180
180
|
try {
|
|
181
|
-
return (await
|
|
181
|
+
return (await k.get("http://localhost:3001/api/ads", {
|
|
182
182
|
params: {
|
|
183
183
|
// ad_id: data.ad_id
|
|
184
184
|
}
|
|
185
185
|
})).data;
|
|
186
186
|
} catch {
|
|
187
187
|
}
|
|
188
|
-
return
|
|
188
|
+
return k.get(s.url, {
|
|
189
189
|
params: {
|
|
190
190
|
// ad_id: data.ad_id
|
|
191
191
|
}
|
|
192
192
|
}).then((t) => t.data);
|
|
193
|
-
},
|
|
194
|
-
dedupingInterval:
|
|
195
|
-
focusThrottleInterval:
|
|
193
|
+
}, F = 60, _e = {
|
|
194
|
+
dedupingInterval: K(F),
|
|
195
|
+
focusThrottleInterval: K(F)
|
|
196
196
|
// keepPreviousData: true,
|
|
197
197
|
// fallbackData: []
|
|
198
|
-
},
|
|
199
|
-
const { data: t, error:
|
|
198
|
+
}, we = (s) => {
|
|
199
|
+
const { data: t, error: l, isLoading: r, mutate: o } = J(
|
|
200
200
|
s?.loading || s?.disabled ? null : {
|
|
201
201
|
url: "https://articles.media/api/ads"
|
|
202
202
|
// ad_id
|
|
203
203
|
},
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
be,
|
|
205
|
+
_e
|
|
206
206
|
);
|
|
207
207
|
return {
|
|
208
208
|
data: t,
|
|
209
|
-
error:
|
|
209
|
+
error: l,
|
|
210
210
|
isLoading: r,
|
|
211
|
-
mutate:
|
|
211
|
+
mutate: o
|
|
212
212
|
};
|
|
213
|
-
},
|
|
214
|
-
function
|
|
213
|
+
}, Ae = G(() => import("./AdDetailsModal-Bp5hZm9N.js")), ke = G(() => import("./AdConfirmExitModal-CKkMAvBK.js"));
|
|
214
|
+
function ye(s, t) {
|
|
215
215
|
return Math.floor(Math.random() * (t - s + 1)) + s;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function Me(s) {
|
|
218
218
|
let {
|
|
219
219
|
previewMode: t,
|
|
220
|
-
darkMode:
|
|
220
|
+
darkMode: l,
|
|
221
221
|
user_ad_token: r,
|
|
222
|
-
userDetails:
|
|
223
|
-
userDetailsLoading:
|
|
222
|
+
userDetails: o,
|
|
223
|
+
userDetailsLoading: c,
|
|
224
|
+
prepend: u,
|
|
225
|
+
append: n
|
|
224
226
|
} = s;
|
|
225
|
-
const
|
|
226
|
-
data:
|
|
227
|
-
} =
|
|
227
|
+
const h = !1, N = [], [f, _] = p(null), {
|
|
228
|
+
data: b
|
|
229
|
+
} = we(
|
|
228
230
|
{
|
|
229
|
-
loading:
|
|
230
|
-
disabled:
|
|
231
|
+
loading: c,
|
|
232
|
+
disabled: o?.articles_membership?.status == "Active"
|
|
231
233
|
}
|
|
232
|
-
), { data: a } =
|
|
233
|
-
let
|
|
234
|
-
const [M,
|
|
234
|
+
), { data: a } = xe(f, r);
|
|
235
|
+
let i = s.previewData || {};
|
|
236
|
+
const [M, C] = p(null), [D, R] = p(null), [m, x] = p(null), [v, j] = p(0), [$, Q] = p(!1), [L, V] = p(!1), [Y, O] = p(!1), [De, Ee] = p(/* @__PURE__ */ new Date()), [T, Z] = p([]);
|
|
235
237
|
y(() => {
|
|
236
|
-
|
|
237
|
-
}, [
|
|
238
|
+
b && b?.length > 0 && !f && (console.log("Ad Mounted or reduxAds changed"), _(s.ad_id || b[ye(0, b?.length - 1)]?._id));
|
|
239
|
+
}, [b]), y(() => {
|
|
238
240
|
}, [a]), y(() => {
|
|
239
|
-
a?.populated_promos &&
|
|
240
|
-
}, [
|
|
241
|
-
function
|
|
242
|
-
|
|
241
|
+
a?.populated_promos && v >= 0 && x(a?.populated_promos[v]);
|
|
242
|
+
}, [v, a]);
|
|
243
|
+
function ee() {
|
|
244
|
+
V(!L);
|
|
243
245
|
}
|
|
244
|
-
const { ref:
|
|
246
|
+
const { ref: se, inView: w } = fe({
|
|
245
247
|
/* Optional options */
|
|
246
248
|
threshold: 0,
|
|
247
249
|
triggerOnce: !0
|
|
248
250
|
});
|
|
249
|
-
function
|
|
250
|
-
if (t && console.log("Preventing this event from being logged as this ad is being shown in preview mode."),
|
|
251
|
+
function B(d) {
|
|
252
|
+
if (t && console.log("Preventing this event from being logged as this ad is being shown in preview mode."), T.find((g) => g == d)) {
|
|
251
253
|
console.log("Already logged this event");
|
|
252
254
|
return;
|
|
253
255
|
}
|
|
254
|
-
|
|
256
|
+
k.get("/api/ads/event", {
|
|
255
257
|
params: {
|
|
256
258
|
ad_id: a?._id,
|
|
257
|
-
event:
|
|
259
|
+
event: d
|
|
258
260
|
}
|
|
259
261
|
}).then(function(g) {
|
|
260
|
-
|
|
262
|
+
Z([...T, d]), console.log(g.data);
|
|
261
263
|
}).catch(function(g) {
|
|
262
264
|
console.log(g);
|
|
263
265
|
});
|
|
264
266
|
}
|
|
265
267
|
y(() => {
|
|
266
|
-
if (!t && (console.log("inView",
|
|
267
|
-
let
|
|
268
|
+
if (!t && (console.log("inView", w), w && f)) {
|
|
269
|
+
let d = [
|
|
268
270
|
{
|
|
269
|
-
ad_id:
|
|
271
|
+
ad_id: f,
|
|
270
272
|
date: (/* @__PURE__ */ new Date()).toString()
|
|
271
273
|
},
|
|
272
|
-
...
|
|
274
|
+
...N.filter((g) => {
|
|
273
275
|
if (console.log(
|
|
274
|
-
|
|
275
|
-
),
|
|
276
|
+
q(/* @__PURE__ */ new Date(), new Date(g.date))
|
|
277
|
+
), q(/* @__PURE__ */ new Date(), new Date(g.date)) > 5) {
|
|
276
278
|
console.log("adsViewed - Remove Old Ad View Object");
|
|
277
279
|
return;
|
|
278
280
|
} else
|
|
279
281
|
return console.log("adsViewed - Keep Ad View Object"), g;
|
|
280
282
|
})
|
|
281
283
|
];
|
|
282
|
-
console.log("unexpiredRecentViews",
|
|
284
|
+
console.log("unexpiredRecentViews", d);
|
|
283
285
|
}
|
|
284
|
-
}, [
|
|
285
|
-
const [
|
|
286
|
-
function
|
|
287
|
-
|
|
286
|
+
}, [w, f]);
|
|
287
|
+
const [W, te] = p(null), [ae, P] = p(!1);
|
|
288
|
+
function U() {
|
|
289
|
+
P(!0), console.log("logAdAvoided called", r), k.get(
|
|
288
290
|
process.env.NODE_ENV === "development" ? "http://localhost:3001/api/user/advertising/avoided" : "https://articles.media/api/user/advertising/avoided",
|
|
289
291
|
{
|
|
290
292
|
params: {
|
|
291
|
-
user_id:
|
|
293
|
+
user_id: o?._id
|
|
292
294
|
},
|
|
293
295
|
headers: {
|
|
294
296
|
"x-articles-api-key": r
|
|
295
297
|
}
|
|
296
298
|
}
|
|
297
|
-
).then(function(
|
|
298
|
-
|
|
299
|
-
}).catch(function(
|
|
300
|
-
console.log(
|
|
299
|
+
).then(function(d) {
|
|
300
|
+
P(!1), te(d.data.avoided_count), console.log(d.data);
|
|
301
|
+
}).catch(function(d) {
|
|
302
|
+
console.log(d), P(!1);
|
|
301
303
|
});
|
|
302
304
|
}
|
|
303
305
|
return y(() => {
|
|
304
|
-
t || (console.log("inView",
|
|
305
|
-
}, [
|
|
306
|
+
t || (console.log("inView", w), o?.articles_membership?.status == "Active" && w && U());
|
|
307
|
+
}, [w, o]), c ? null : /* @__PURE__ */ e.jsxs(
|
|
306
308
|
"div",
|
|
307
309
|
{
|
|
308
|
-
ref:
|
|
309
|
-
className:
|
|
310
|
+
ref: se,
|
|
311
|
+
className: le(
|
|
310
312
|
"ad-wrap",
|
|
311
313
|
{
|
|
312
|
-
"active-member":
|
|
314
|
+
"active-member": o?.articles_membership?.status == "Active"
|
|
313
315
|
}
|
|
314
316
|
),
|
|
315
317
|
style: {
|
|
316
|
-
"--articles-ad-background-color":
|
|
317
|
-
"--articles-ad-font-color":
|
|
318
|
-
"--articles-ad-border-color":
|
|
318
|
+
"--articles-ad-background-color": i.background_color || a?.background_color,
|
|
319
|
+
"--articles-ad-font-color": i.font_color || a?.font_color,
|
|
320
|
+
"--articles-ad-border-color": i.border_color || a?.border_color
|
|
319
321
|
},
|
|
320
322
|
children: [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
+
L && /* @__PURE__ */ e.jsx(
|
|
324
|
+
Ae,
|
|
323
325
|
{
|
|
324
|
-
setModalShow:
|
|
326
|
+
setModalShow: V,
|
|
325
327
|
ad: a,
|
|
326
|
-
previewData:
|
|
328
|
+
previewData: i
|
|
327
329
|
}
|
|
328
330
|
),
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
Y && /* @__PURE__ */ e.jsx(
|
|
332
|
+
ke,
|
|
331
333
|
{
|
|
332
|
-
setModalShow:
|
|
334
|
+
setModalShow: O,
|
|
333
335
|
ad: a,
|
|
334
|
-
previewData:
|
|
336
|
+
previewData: i
|
|
335
337
|
}
|
|
336
338
|
),
|
|
339
|
+
u && /* @__PURE__ */ e.jsx("div", { className: "prepend-container", children: u }),
|
|
337
340
|
/* @__PURE__ */ e.jsxs(
|
|
338
341
|
"div",
|
|
339
342
|
{
|
|
340
343
|
className: "ad",
|
|
341
344
|
children: [
|
|
342
|
-
|
|
345
|
+
o?.articles_membership?.status !== "Active" && /* @__PURE__ */ e.jsxs(
|
|
343
346
|
"div",
|
|
344
347
|
{
|
|
345
348
|
className: "main-panel",
|
|
@@ -350,10 +353,10 @@ function ke(s) {
|
|
|
350
353
|
] }) }),
|
|
351
354
|
/* @__PURE__ */ e.jsxs("div", { className: "content-wrap", children: [
|
|
352
355
|
/* @__PURE__ */ e.jsxs("div", { className: "photo-banner", children: [
|
|
353
|
-
/* @__PURE__ */ e.jsx("div", { className: "logo", children: (
|
|
356
|
+
/* @__PURE__ */ e.jsx("div", { className: "logo", children: (i.logo?.location || a?.logo?.location) && /* @__PURE__ */ e.jsx(
|
|
354
357
|
"img",
|
|
355
358
|
{
|
|
356
|
-
src:
|
|
359
|
+
src: i?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${i?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${a?.logo?.key}`,
|
|
357
360
|
alt: ""
|
|
358
361
|
}
|
|
359
362
|
) }),
|
|
@@ -362,14 +365,14 @@ function ke(s) {
|
|
|
362
365
|
"img",
|
|
363
366
|
{
|
|
364
367
|
className: "photo",
|
|
365
|
-
src:
|
|
368
|
+
src: i?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${i.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${a?.background?.key}`,
|
|
366
369
|
alt: ""
|
|
367
370
|
}
|
|
368
371
|
)
|
|
369
372
|
] }),
|
|
370
373
|
/* @__PURE__ */ e.jsxs("div", { className: "details-wrap", children: [
|
|
371
374
|
/* @__PURE__ */ e.jsxs("div", { className: "detail-title", children: [
|
|
372
|
-
/* @__PURE__ */ e.jsx("div", { className: "detail", children: /* @__PURE__ */ e.jsx("span", { className: "h4", children:
|
|
375
|
+
/* @__PURE__ */ e.jsx("div", { className: "detail", children: /* @__PURE__ */ e.jsx("span", { className: "h4", children: i?.business || a?.business }) }),
|
|
373
376
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-column d-none", children: [
|
|
374
377
|
/* @__PURE__ */ e.jsxs("div", { className: "detail", children: [
|
|
375
378
|
/* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx("i", { className: "fas fa-search-location" }) }),
|
|
@@ -386,33 +389,33 @@ function ke(s) {
|
|
|
386
389
|
] })
|
|
387
390
|
] }),
|
|
388
391
|
a?.city && /* @__PURE__ */ e.jsx("div", { className: "details mb-3 d-none" }),
|
|
389
|
-
/* @__PURE__ */ e.jsx("div", { className: "short-description", children:
|
|
392
|
+
/* @__PURE__ */ e.jsx("div", { className: "short-description", children: i?.description || a?.description })
|
|
390
393
|
] })
|
|
391
394
|
] }),
|
|
392
|
-
|
|
393
|
-
|
|
395
|
+
h?.roles?.isDev && a?.populated_promos?.length > 0 && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
396
|
+
m && /* @__PURE__ */ e.jsx("div", { className: "promos-wrap", children: m && /* @__PURE__ */ e.jsxs(
|
|
394
397
|
"div",
|
|
395
398
|
{
|
|
396
399
|
className: "promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",
|
|
397
400
|
children: [
|
|
398
401
|
/* @__PURE__ */ e.jsxs("div", { className: "", children: [
|
|
399
|
-
/* @__PURE__ */ e.jsx("div", { children:
|
|
400
|
-
/* @__PURE__ */ e.jsx("div", { className: "small", children: /* @__PURE__ */ e.jsx("div", { className: "small", children:
|
|
402
|
+
/* @__PURE__ */ e.jsx("div", { children: m.title }),
|
|
403
|
+
/* @__PURE__ */ e.jsx("div", { className: "small", children: /* @__PURE__ */ e.jsx("div", { className: "small", children: m.details }) })
|
|
401
404
|
] }),
|
|
402
405
|
/* @__PURE__ */ e.jsx(
|
|
403
|
-
|
|
406
|
+
oe,
|
|
404
407
|
{
|
|
405
408
|
className: "px-3",
|
|
406
409
|
small: !0,
|
|
407
410
|
onClick: () => {
|
|
408
|
-
console.log("Load Save Modal"),
|
|
411
|
+
console.log("Load Save Modal"), Q(!0);
|
|
409
412
|
},
|
|
410
413
|
children: "Save"
|
|
411
414
|
}
|
|
412
415
|
)
|
|
413
416
|
]
|
|
414
417
|
},
|
|
415
|
-
|
|
418
|
+
m._id
|
|
416
419
|
) }),
|
|
417
420
|
/* @__PURE__ */ e.jsxs("div", { className: "d-flex justify-content-between", children: [
|
|
418
421
|
/* @__PURE__ */ e.jsxs("div", { className: "px-2", children: [
|
|
@@ -426,17 +429,17 @@ function ke(s) {
|
|
|
426
429
|
className: "fad fa-arrow-circle-left",
|
|
427
430
|
type: "button",
|
|
428
431
|
onClick: () => {
|
|
429
|
-
|
|
432
|
+
v == 0 ? j(a?.populated_promos?.length - 1) : j((d) => d - 1);
|
|
430
433
|
}
|
|
431
434
|
}
|
|
432
435
|
),
|
|
433
436
|
a?.populated_promos?.map(
|
|
434
|
-
(
|
|
437
|
+
(d, g) => /* @__PURE__ */ e.jsx(
|
|
435
438
|
"i",
|
|
436
439
|
{
|
|
437
|
-
className: `fa-square ${g ==
|
|
440
|
+
className: `fa-square ${g == v ? "fad" : "fas"}`
|
|
438
441
|
},
|
|
439
|
-
|
|
442
|
+
d._id
|
|
440
443
|
)
|
|
441
444
|
),
|
|
442
445
|
/* @__PURE__ */ e.jsx(
|
|
@@ -445,7 +448,7 @@ function ke(s) {
|
|
|
445
448
|
className: "fad fa-arrow-circle-right",
|
|
446
449
|
type: "button",
|
|
447
450
|
onClick: () => {
|
|
448
|
-
|
|
451
|
+
v == a?.populated_promos?.length - 1 ? j(0) : j((d) => d + 1);
|
|
449
452
|
}
|
|
450
453
|
}
|
|
451
454
|
)
|
|
@@ -458,7 +461,7 @@ function ke(s) {
|
|
|
458
461
|
"div",
|
|
459
462
|
{
|
|
460
463
|
onClick: () => {
|
|
461
|
-
|
|
464
|
+
ee(), B("Details");
|
|
462
465
|
},
|
|
463
466
|
className: "action flex-grow-1 flex-shrink-0",
|
|
464
467
|
children: "Details"
|
|
@@ -472,8 +475,8 @@ function ke(s) {
|
|
|
472
475
|
href: a?.website,
|
|
473
476
|
target: "_blank",
|
|
474
477
|
rel: "noreferrer",
|
|
475
|
-
onClick: (
|
|
476
|
-
|
|
478
|
+
onClick: (d) => {
|
|
479
|
+
d.preventDefault(), O(!0), B("Confirm Exit Modal Opened");
|
|
477
480
|
},
|
|
478
481
|
children: /* @__PURE__ */ e.jsx("div", { children: "Website" })
|
|
479
482
|
}
|
|
@@ -482,7 +485,7 @@ function ke(s) {
|
|
|
482
485
|
]
|
|
483
486
|
}
|
|
484
487
|
),
|
|
485
|
-
|
|
488
|
+
o?.articles_membership?.status == "Active" && /* @__PURE__ */ e.jsx(
|
|
486
489
|
"div",
|
|
487
490
|
{
|
|
488
491
|
className: "main-panel",
|
|
@@ -496,7 +499,7 @@ function ke(s) {
|
|
|
496
499
|
"div",
|
|
497
500
|
{
|
|
498
501
|
className: "count",
|
|
499
|
-
children:
|
|
502
|
+
children: ae ? /* @__PURE__ */ e.jsx("i", { className: "fas fa-spinner fa-spin me-0" }) : W ? ne(W) : 0
|
|
500
503
|
}
|
|
501
504
|
),
|
|
502
505
|
/* @__PURE__ */ e.jsx("div", { className: "label", children: "ads avoided." })
|
|
@@ -508,7 +511,7 @@ function ke(s) {
|
|
|
508
511
|
className: "member-since",
|
|
509
512
|
children: [
|
|
510
513
|
"Member since: ",
|
|
511
|
-
/* @__PURE__ */ e.jsx(
|
|
514
|
+
/* @__PURE__ */ e.jsx(ie, { format: "PP", date: o?.articles_membership?.membership_started })
|
|
512
515
|
]
|
|
513
516
|
}
|
|
514
517
|
)
|
|
@@ -519,7 +522,7 @@ function ke(s) {
|
|
|
519
522
|
/* @__PURE__ */ e.jsx("div", { className: "mb-2", children: "Without support from users like you, we wouldn't be here." }),
|
|
520
523
|
/* @__PURE__ */ e.jsxs("div", { className: "links-list", children: [
|
|
521
524
|
/* @__PURE__ */ e.jsxs(
|
|
522
|
-
|
|
525
|
+
E,
|
|
523
526
|
{
|
|
524
527
|
newPage: !0,
|
|
525
528
|
className: "link-item",
|
|
@@ -531,13 +534,13 @@ function ke(s) {
|
|
|
531
534
|
}
|
|
532
535
|
),
|
|
533
536
|
/* @__PURE__ */ e.jsxs(
|
|
534
|
-
|
|
537
|
+
E,
|
|
535
538
|
{
|
|
536
539
|
newPage: !0,
|
|
537
540
|
className: "link-item",
|
|
538
541
|
href: "https://articles.media/settings/notifications",
|
|
539
542
|
onClick: () => {
|
|
540
|
-
|
|
543
|
+
U();
|
|
541
544
|
},
|
|
542
545
|
children: [
|
|
543
546
|
/* @__PURE__ */ e.jsx("i", { className: "fas fa-bell" }),
|
|
@@ -546,7 +549,7 @@ function ke(s) {
|
|
|
546
549
|
}
|
|
547
550
|
),
|
|
548
551
|
/* @__PURE__ */ e.jsxs(
|
|
549
|
-
|
|
552
|
+
E,
|
|
550
553
|
{
|
|
551
554
|
newPage: !0,
|
|
552
555
|
className: "link-item",
|
|
@@ -566,18 +569,19 @@ function ke(s) {
|
|
|
566
569
|
]
|
|
567
570
|
}
|
|
568
571
|
),
|
|
572
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "append-container", children: n }),
|
|
569
573
|
!t && /* @__PURE__ */ e.jsx(
|
|
570
574
|
"div",
|
|
571
575
|
{
|
|
572
576
|
className: "advertise-with-us p-1",
|
|
573
577
|
style: {
|
|
574
578
|
// ...(props.previewData ? props.previewData.background_color : ad?.background_color),
|
|
575
|
-
backgroundColor:
|
|
576
|
-
color:
|
|
577
|
-
borderColor:
|
|
579
|
+
backgroundColor: i.background_color || a?.background_color,
|
|
580
|
+
color: i.font_color || a?.font_color,
|
|
581
|
+
borderColor: i.border_color || a?.border_color
|
|
578
582
|
},
|
|
579
583
|
children: /* @__PURE__ */ e.jsxs(
|
|
580
|
-
|
|
584
|
+
E,
|
|
581
585
|
{
|
|
582
586
|
className: "small d-block w-100 text-center",
|
|
583
587
|
href: "https://articles.media/advertising",
|
|
@@ -594,7 +598,7 @@ function ke(s) {
|
|
|
594
598
|
}
|
|
595
599
|
);
|
|
596
600
|
}
|
|
597
|
-
const
|
|
601
|
+
const Le = re(Me);
|
|
598
602
|
export {
|
|
599
|
-
|
|
603
|
+
Le as default
|
|
600
604
|
};
|
package/dist/FriendsList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),x=require("./index-Ddv_TnxK.cjs"),c=require("./Button-0ZK0NKiK.cjs"),a=require("./Modal-Wmqy9fOm.cjs"),
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),x=require("./index-Ddv_TnxK.cjs"),c=require("./Button-0ZK0NKiK.cjs"),a=require("./Modal-Wmqy9fOm.cjs"),f=async s=>{if(process.env.NODE_ENV==="development")try{return(await x.axios.get("http://localhost:3001/api/user/friends",{params:{game:s.game},headers:{"x-articles-api-key":s.user_token}})).data}catch{}return x.axios.get(s.url,{params:{game:s.game},headers:{"x-articles-api-key":s.user_token}}).then(t=>t.data)},E={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},R=s=>{const{data:t,error:n,isLoading:l,isValidating:o,mutate:d}=x.useSWR(s?.user_id&&s?.user_token?{url:"https://articles.media/api/user/friends",user_token:s.user_token}:null,f,E);return{data:t,error:n,isLoading:l,isValidating:o,mutate:d}};function g({show:s,setShow:t,componentType:n,className:l,style:o={},user_id:d,user_token:m,id:p=null,allowInvite:_=!1,inviteFunction:v=null,modalBackdropClassName:j=""}){const{data:r,isLoading:u,mutate:h}=R({user_id:d,user_token:m});if((!n||n=="list")&&!u&&r&&r.length>0)return e.jsxRuntimeExports.jsx("ul",{className:l,style:o,children:r.map(i=>e.jsxRuntimeExports.jsxs("li",{children:[i?.populated_user?.username," - ",i?.populated_user?.display_name||"No Display Name"]},i.user_id))});if(n.toLowerCase()=="modal")return e.jsxRuntimeExports.jsxs(a.Modal,{show:s,size:"md",className:`articles-modal ${l}`,modalBackdropClassName:j,centered:!0,onHide:()=>t(!1),style:o,id:p,children:[e.jsxRuntimeExports.jsx(a.Modal.Header,{children:e.jsxRuntimeExports.jsx(a.Modal.Title,{children:"Friends"})}),e.jsxRuntimeExports.jsxs(a.Modal.Body,{children:[u&&e.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-spinner-third fa-spin fa-2x"}),e.jsxRuntimeExports.jsx("div",{children:"Loading..."})]}),!u&&r&&r.length==0&&e.jsxRuntimeExports.jsx("div",{children:"No friends to show."}),!u&&r&&r.length>0&&e.jsxRuntimeExports.jsx("ul",{children:r.map(i=>e.jsxRuntimeExports.jsxs("li",{children:[i?.populated_user?.username," - ",i?.populated_user?.display_name||"No Display Name"]},i.user_id))})]}),e.jsxRuntimeExports.jsxs(a.Modal.Footer,{className:"justify-content-between",children:[e.jsxRuntimeExports.jsx(c.ArticlesButton,{variant:"articles",onClick:()=>{h()},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo"})}),e.jsxRuntimeExports.jsx(c.ArticlesButton,{variant:"articles",onClick:()=>{t(!1)},children:"Close"})]})]})}module.exports=g;
|
package/dist/FriendsList.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-tc70JA_2.js";
|
|
2
|
-
import { u as
|
|
2
|
+
import { u as g, a as c } from "./index-DLYx67wi.js";
|
|
3
3
|
import { A as m } from "./Button-_Quon8UV.js";
|
|
4
4
|
import { M as n } from "./Modal-C9oYRgI1.js";
|
|
5
|
-
const
|
|
5
|
+
const j = async (s) => {
|
|
6
6
|
if (process.env.NODE_ENV === "development")
|
|
7
7
|
try {
|
|
8
8
|
return (await c.get("http://localhost:3001/api/user/friends", {
|
|
@@ -24,23 +24,23 @@ const g = async (s) => {
|
|
|
24
24
|
"x-articles-api-key": s.user_token
|
|
25
25
|
}
|
|
26
26
|
}).then((a) => a.data);
|
|
27
|
-
},
|
|
27
|
+
}, _ = {
|
|
28
28
|
dedupingInterval: 1e3 * 60 * 30,
|
|
29
29
|
refreshInterval: 0,
|
|
30
30
|
revalidateOnFocus: !1,
|
|
31
31
|
revalidateIfStale: !1,
|
|
32
32
|
shouldRetryOnError: !1
|
|
33
33
|
// fallbackData: []
|
|
34
|
-
},
|
|
35
|
-
const { data: a, error: t, isLoading: l, isValidating: d, mutate: u } =
|
|
34
|
+
}, v = (s) => {
|
|
35
|
+
const { data: a, error: t, isLoading: l, isValidating: d, mutate: u } = g(
|
|
36
36
|
s?.user_id && s?.user_token ? {
|
|
37
37
|
// url: "/api/community/games/scoreboard",
|
|
38
38
|
url: "https://articles.media/api/user/friends",
|
|
39
39
|
// game: params.game,
|
|
40
40
|
user_token: s.user_token
|
|
41
41
|
} : null,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
j,
|
|
43
|
+
_
|
|
44
44
|
);
|
|
45
45
|
return {
|
|
46
46
|
data: a,
|
|
@@ -50,7 +50,7 @@ const g = async (s) => {
|
|
|
50
50
|
mutate: u
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
-
function
|
|
53
|
+
function C({
|
|
54
54
|
show: s,
|
|
55
55
|
setShow: a,
|
|
56
56
|
componentType: t,
|
|
@@ -59,15 +59,16 @@ function w({
|
|
|
59
59
|
user_id: u,
|
|
60
60
|
user_token: f,
|
|
61
61
|
id: h = null,
|
|
62
|
-
allowInvite:
|
|
63
|
-
inviteFunction:
|
|
62
|
+
allowInvite: N = !1,
|
|
63
|
+
inviteFunction: k = null,
|
|
64
|
+
modalBackdropClassName: p = ""
|
|
64
65
|
}) {
|
|
65
66
|
const {
|
|
66
67
|
data: r,
|
|
67
68
|
isLoading: o,
|
|
68
69
|
// isValidating: friendsValidating,
|
|
69
|
-
mutate:
|
|
70
|
-
} =
|
|
70
|
+
mutate: x
|
|
71
|
+
} = v({
|
|
71
72
|
user_id: u,
|
|
72
73
|
user_token: f
|
|
73
74
|
});
|
|
@@ -84,6 +85,7 @@ function w({
|
|
|
84
85
|
show: s,
|
|
85
86
|
size: "md",
|
|
86
87
|
className: `articles-modal ${l}`,
|
|
88
|
+
modalBackdropClassName: p,
|
|
87
89
|
centered: !0,
|
|
88
90
|
onHide: () => a(!1),
|
|
89
91
|
style: d,
|
|
@@ -108,7 +110,7 @@ function w({
|
|
|
108
110
|
{
|
|
109
111
|
variant: "articles",
|
|
110
112
|
onClick: () => {
|
|
111
|
-
|
|
113
|
+
x();
|
|
112
114
|
},
|
|
113
115
|
children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo" })
|
|
114
116
|
}
|
|
@@ -129,5 +131,5 @@ function w({
|
|
|
129
131
|
);
|
|
130
132
|
}
|
|
131
133
|
export {
|
|
132
|
-
|
|
134
|
+
C as default
|
|
133
135
|
};
|
package/dist/GameScoreboard.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),l=require("react"),i=require("./Modal-Wmqy9fOm.cjs"),E=require("./ViewUserModal.cjs"),m=require("./Button-0ZK0NKiK.cjs"),d=require("./index-Ddv_TnxK.cjs");function R({setChecked:s,checked:t,readOnly:a}){return e.jsxRuntimeExports.jsxs("label",{className:`articles-switch mb-0 ${t&&"checked"}`,children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",readOnly:!!a,checked:t,onChange:()=>{}}),e.jsxRuntimeExports.jsx("span",{onClick:n=>{if(s){s(!t);return}else{n.preventDefault();return}},className:"slider"})]})}const b=async s=>{if(process.env.NODE_ENV==="development")try{return(await d.axios.get("http://localhost:3001/api/community/games/scoreboard",{params:{game:s.game}})).data}catch{}return d.axios.get(s.url,{params:{game:s.game}}).then(t=>t.data)},N={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},v=s=>{const{data:t,error:a,isLoading:n,isValidating:o,mutate:c}=d.useSWR(s?.game?{url:"https://articles.media/api/community/games/scoreboard",game:s.game}:null,b,N);return{data:t,error:a,isLoading:n,isValidating:o,mutate:c}};function y({game:s,reloadScoreboard:t,setReloadScoreboard:a,prepend:n,append:o}){const[c,x]=l.useState(!1),[u,h]=l.useState(!1),{data:j,mutate:p}=v({game:s});return l.useEffect(()=>{},[]),l.useEffect(()=>{t&&(a(!1),p())},[t]),e.jsxRuntimeExports.jsxs("div",{className:"scoreboard",children:[e.jsxRuntimeExports.jsxs(i.Modal,{show:c,size:"md",className:"articles-modal",centered:!0,onHide:()=>x(!1),children:[e.jsxRuntimeExports.jsx(i.Modal.Header,{children:e.jsxRuntimeExports.jsx(i.Modal.Title,{children:"Scoreboard Settings"})}),e.jsxRuntimeExports.jsx(i.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between align-items-center",onClick:()=>h(!u),children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("i",{className:"fas fa-trophy-alt"}),e.jsxRuntimeExports.jsx("span",{children:"Join Scoreboard?"})]}),e.jsxRuntimeExports.jsx(R,{checked:u})]})}),e.jsxRuntimeExports.jsx(i.Modal.Footer,{className:"justify-content-between",children:e.jsxRuntimeExports.jsx(m.ArticlesButton,{variant:"articles",onClick:()=>{x(!1)},children:"Close"})})]}),e.jsxRuntimeExports.jsx("div",{className:"prepend-container",children:n}),e.jsxRuntimeExports.jsxs("div",{className:"card card-articles card-sm mb-3 mb-lg-0",children:[e.jsxRuntimeExports.jsxs("div",{className:"card-header d-flex justify-content-between align-items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[s," Scoreboard"]}),e.jsxRuntimeExports.jsx(m.ArticlesButton,{onClick:()=>{p()},small:!0,children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-0"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card-body p-0",children:[(j?.length||0)==0&&e.jsxRuntimeExports.jsx("div",{className:"small p-2",children:"No scores yet"}),j?.map((r,f)=>e.jsxRuntimeExports.jsxs("div",{className:"result d-flex flex-column justify-content-between border-bottom p-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between lh-sm",children:[e.jsxRuntimeExports.jsxs("div",{className:"d-flex",children:[e.jsxRuntimeExports.jsx("h5",{className:"mb-0 me-3",children:f+1}),e.jsxRuntimeExports.jsx("div",{className:"lh-sm",children:e.jsxRuntimeExports.jsx(E,{populated_user:r.populated_user,user_id:r.user_id})})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("h5",{className:"mb-0",children:r.score||r.total})})]}),r.last_play&&r.public_last_play&&e.jsxRuntimeExports.jsxs("small",{className:"mt-1",style:{fontSize:"0.75rem"},children:["Played: ",format(new Date(r.last_play),"MM/d/yy hh:mmaa")]})]},r._id))]}),e.jsxRuntimeExports.jsxs("div",{className:"card-footer d-flex justify-content-between align-items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"small",children:"Play to get on the board!"}),e.jsxRuntimeExports.jsx(m.ArticlesButton,{small:!0,onClick:()=>{x(!0)},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-cog me-0"})})]})]}),e.jsxRuntimeExports.jsx("div",{className:"append-container",children:o})]})}module.exports=y;
|
package/dist/GameScoreboard.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-tc70JA_2.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { M as
|
|
4
|
-
import
|
|
2
|
+
import { useState as f, useEffect as x } from "react";
|
|
3
|
+
import { M as i } from "./Modal-C9oYRgI1.js";
|
|
4
|
+
import N from "./ViewUserModal.js";
|
|
5
5
|
import { A as o } from "./Button-_Quon8UV.js";
|
|
6
|
-
import { u as
|
|
6
|
+
import { u as v, a as j } from "./index-DLYx67wi.js";
|
|
7
7
|
function y({
|
|
8
8
|
setChecked: s,
|
|
9
9
|
checked: a,
|
|
@@ -37,64 +37,70 @@ function y({
|
|
|
37
37
|
)
|
|
38
38
|
] });
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const g = async (s) => {
|
|
41
41
|
if (process.env.NODE_ENV === "development")
|
|
42
42
|
try {
|
|
43
|
-
return (await
|
|
43
|
+
return (await j.get("http://localhost:3001/api/community/games/scoreboard", {
|
|
44
44
|
params: {
|
|
45
45
|
game: s.game
|
|
46
46
|
}
|
|
47
47
|
})).data;
|
|
48
48
|
} catch {
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return j.get(s.url, {
|
|
51
51
|
params: {
|
|
52
52
|
game: s.game
|
|
53
53
|
}
|
|
54
54
|
}).then((a) => a.data);
|
|
55
|
-
},
|
|
55
|
+
}, w = {
|
|
56
56
|
dedupingInterval: 1e3 * 60 * 30,
|
|
57
57
|
refreshInterval: 0,
|
|
58
58
|
revalidateOnFocus: !1,
|
|
59
59
|
revalidateIfStale: !1,
|
|
60
60
|
shouldRetryOnError: !1
|
|
61
61
|
// fallbackData: []
|
|
62
|
-
},
|
|
63
|
-
const { data: a, error: r, isLoading: l, isValidating:
|
|
62
|
+
}, S = (s) => {
|
|
63
|
+
const { data: a, error: r, isLoading: l, isValidating: n, mutate: c } = v(
|
|
64
64
|
s?.game ? {
|
|
65
65
|
// url: "/api/community/games/scoreboard",
|
|
66
66
|
url: "https://articles.media/api/community/games/scoreboard",
|
|
67
67
|
game: s.game
|
|
68
68
|
} : null,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
g,
|
|
70
|
+
w
|
|
71
71
|
);
|
|
72
72
|
return {
|
|
73
73
|
data: a,
|
|
74
74
|
error: r,
|
|
75
75
|
isLoading: l,
|
|
76
|
-
isValidating:
|
|
76
|
+
isValidating: n,
|
|
77
77
|
mutate: c
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
function V({
|
|
81
|
+
game: s,
|
|
82
|
+
reloadScoreboard: a,
|
|
83
|
+
setReloadScoreboard: r,
|
|
84
|
+
prepend: l,
|
|
85
|
+
append: n
|
|
86
|
+
}) {
|
|
87
|
+
const [c, d] = f(!1), [m, p] = f(!1), {
|
|
88
|
+
data: h,
|
|
89
|
+
mutate: u
|
|
90
|
+
} = S({
|
|
85
91
|
game: s
|
|
86
92
|
});
|
|
87
|
-
return
|
|
88
|
-
}, []),
|
|
89
|
-
a && (r(!1),
|
|
93
|
+
return x(() => {
|
|
94
|
+
}, []), x(() => {
|
|
95
|
+
a && (r(!1), u());
|
|
90
96
|
}, [a]), /* @__PURE__ */ e.jsxs("div", { className: "scoreboard", children: [
|
|
91
|
-
/* @__PURE__ */ e.jsxs(
|
|
92
|
-
/* @__PURE__ */ e.jsx(
|
|
93
|
-
/* @__PURE__ */ e.jsx(
|
|
97
|
+
/* @__PURE__ */ e.jsxs(i, { show: c, size: "md", className: "articles-modal", centered: !0, onHide: () => d(!1), children: [
|
|
98
|
+
/* @__PURE__ */ e.jsx(i.Header, { children: /* @__PURE__ */ e.jsx(i.Title, { children: "Scoreboard Settings" }) }),
|
|
99
|
+
/* @__PURE__ */ e.jsx(i.Body, { children: /* @__PURE__ */ e.jsxs(
|
|
94
100
|
"div",
|
|
95
101
|
{
|
|
96
102
|
className: "d-flex justify-content-between align-items-center",
|
|
97
|
-
onClick: () =>
|
|
103
|
+
onClick: () => p(!m),
|
|
98
104
|
children: [
|
|
99
105
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
100
106
|
/* @__PURE__ */ e.jsx("i", { className: "fas fa-trophy-alt" }),
|
|
@@ -103,23 +109,24 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
|
|
|
103
109
|
/* @__PURE__ */ e.jsx(
|
|
104
110
|
y,
|
|
105
111
|
{
|
|
106
|
-
checked:
|
|
112
|
+
checked: m
|
|
107
113
|
}
|
|
108
114
|
)
|
|
109
115
|
]
|
|
110
116
|
}
|
|
111
117
|
) }),
|
|
112
|
-
/* @__PURE__ */ e.jsx(
|
|
118
|
+
/* @__PURE__ */ e.jsx(i.Footer, { className: "justify-content-between", children: /* @__PURE__ */ e.jsx(
|
|
113
119
|
o,
|
|
114
120
|
{
|
|
115
121
|
variant: "articles",
|
|
116
122
|
onClick: () => {
|
|
117
|
-
|
|
123
|
+
d(!1);
|
|
118
124
|
},
|
|
119
125
|
children: "Close"
|
|
120
126
|
}
|
|
121
127
|
) })
|
|
122
128
|
] }),
|
|
129
|
+
/* @__PURE__ */ e.jsx("div", { className: "prepend-container", children: l }),
|
|
123
130
|
/* @__PURE__ */ e.jsxs("div", { className: "card card-articles card-sm mb-3 mb-lg-0", children: [
|
|
124
131
|
/* @__PURE__ */ e.jsxs("div", { className: "card-header d-flex justify-content-between align-items-center", children: [
|
|
125
132
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
@@ -130,7 +137,7 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
|
|
|
130
137
|
o,
|
|
131
138
|
{
|
|
132
139
|
onClick: () => {
|
|
133
|
-
|
|
140
|
+
u();
|
|
134
141
|
},
|
|
135
142
|
small: !0,
|
|
136
143
|
children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-redo me-0" })
|
|
@@ -138,14 +145,14 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
|
|
|
138
145
|
)
|
|
139
146
|
] }),
|
|
140
147
|
/* @__PURE__ */ e.jsxs("div", { className: "card-body p-0", children: [
|
|
141
|
-
(
|
|
142
|
-
|
|
143
|
-
(t,
|
|
148
|
+
(h?.length || 0) == 0 && /* @__PURE__ */ e.jsx("div", { className: "small p-2", children: "No scores yet" }),
|
|
149
|
+
h?.map(
|
|
150
|
+
(t, b) => /* @__PURE__ */ e.jsxs("div", { className: "result d-flex flex-column justify-content-between border-bottom p-2", children: [
|
|
144
151
|
/* @__PURE__ */ e.jsxs("div", { className: "d-flex justify-content-between lh-sm", children: [
|
|
145
152
|
/* @__PURE__ */ e.jsxs("div", { className: "d-flex", children: [
|
|
146
|
-
/* @__PURE__ */ e.jsx("h5", { className: "mb-0 me-3", children:
|
|
153
|
+
/* @__PURE__ */ e.jsx("h5", { className: "mb-0 me-3", children: b + 1 }),
|
|
147
154
|
/* @__PURE__ */ e.jsx("div", { className: "lh-sm", children: /* @__PURE__ */ e.jsx(
|
|
148
|
-
|
|
155
|
+
N,
|
|
149
156
|
{
|
|
150
157
|
populated_user: t.populated_user,
|
|
151
158
|
user_id: t.user_id
|
|
@@ -168,15 +175,16 @@ function E({ game: s, reloadScoreboard: a, setReloadScoreboard: r }) {
|
|
|
168
175
|
{
|
|
169
176
|
small: !0,
|
|
170
177
|
onClick: () => {
|
|
171
|
-
|
|
178
|
+
d(!0);
|
|
172
179
|
},
|
|
173
180
|
children: /* @__PURE__ */ e.jsx("i", { className: "fad fa-cog me-0" })
|
|
174
181
|
}
|
|
175
182
|
)
|
|
176
183
|
] })
|
|
177
|
-
] })
|
|
184
|
+
] }),
|
|
185
|
+
/* @__PURE__ */ e.jsx("div", { className: "append-container", children: n })
|
|
178
186
|
] });
|
|
179
187
|
}
|
|
180
188
|
export {
|
|
181
|
-
|
|
189
|
+
V as default
|
|
182
190
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),a=require("./Button-0ZK0NKiK.cjs"),n=require("react");function l({className:s,id:r}){const[o,i]=n.useState(!1);if(n.useEffect(()=>{i(!0)},[]),!o)return null;const u=new URLSearchParams(window.location.search),c=Object.fromEntries(u);let{launcher_mode:t}=c;return t=t==="1",t?e.jsxRuntimeExports.jsxs(a.ArticlesButton,{className:`${s} w-100`,id:r,small:!0,style:{zIndex:10,position:"relative"},onClick:()=>{window.location.href="https://games.articles.media"},children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-gamepad"}),"Return to Games"]}):e.jsxRuntimeExports.jsxs(a.ArticlesButton,{className:`${s} w-100`,small:!0,id:r,style:{zIndex:10,position:"relative"},onClick:()=>{window.location.href="https://games.articles.media"},children:[e.jsxRuntimeExports.jsx("i",{className:"fad fa-gamepad"}),"View our other games"]})}module.exports=l;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-tc70JA_2.js";
|
|
2
|
-
import { A as
|
|
3
|
-
import { useState as
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { A as r } from "./Button-_Quon8UV.js";
|
|
3
|
+
import { useState as m, useEffect as c } from "react";
|
|
4
|
+
function p({
|
|
5
|
+
className: s,
|
|
6
|
+
id: a
|
|
7
|
+
}) {
|
|
8
|
+
const [o, n] = m(!1);
|
|
9
|
+
if (c(() => {
|
|
10
|
+
n(!0);
|
|
11
|
+
}, []), !o)
|
|
9
12
|
return null;
|
|
10
|
-
const
|
|
11
|
-
let { launcher_mode: t } =
|
|
13
|
+
const i = new URLSearchParams(window.location.search), l = Object.fromEntries(i);
|
|
14
|
+
let { launcher_mode: t } = l;
|
|
12
15
|
return t = t === "1", t ? /* @__PURE__ */ e.jsxs(
|
|
13
|
-
|
|
16
|
+
r,
|
|
14
17
|
{
|
|
15
|
-
className:
|
|
18
|
+
className: `${s} w-100`,
|
|
19
|
+
id: a,
|
|
16
20
|
small: !0,
|
|
17
21
|
style: {
|
|
18
22
|
zIndex: 10,
|
|
@@ -27,10 +31,11 @@ function f() {
|
|
|
27
31
|
]
|
|
28
32
|
}
|
|
29
33
|
) : /* @__PURE__ */ e.jsxs(
|
|
30
|
-
|
|
34
|
+
r,
|
|
31
35
|
{
|
|
32
|
-
className:
|
|
36
|
+
className: `${s} w-100`,
|
|
33
37
|
small: !0,
|
|
38
|
+
id: a,
|
|
34
39
|
style: {
|
|
35
40
|
zIndex: 10,
|
|
36
41
|
position: "relative"
|
|
@@ -46,5 +51,5 @@ function f() {
|
|
|
46
51
|
);
|
|
47
52
|
}
|
|
48
53
|
export {
|
|
49
|
-
|
|
54
|
+
p as default
|
|
50
55
|
};
|
package/package.json
CHANGED