@articles-media/articles-dev-box 1.0.4 → 1.0.5

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 CHANGED
@@ -1 +1 @@
1
- "use strict";const s=require("./jsx-runtime-Blz-RjDE.cjs"),d=require("react"),R=require("./index-CqsCVLvJ.cjs"),X=require("./Button-CZyAJPvK.cjs");function F(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const N=F(d);var C=new Map,A=new WeakMap,O=0,z;function K(e){return e?(A.has(e)||(O+=1,A.set(e,O.toString())),A.get(e)):"0"}function G(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?K(e.root):e[t]}`).toString()}function H(e){const t=G(e);let o=C.get(t);if(!o){const r=new Map;let l;const i=new IntersectionObserver(c=>{c.forEach(a=>{var x;const E=a.isIntersecting&&l.some(h=>a.intersectionRatio>=h);e.trackVisibility&&typeof a.isVisible>"u"&&(a.isVisible=E),(x=r.get(a.target))==null||x.forEach(h=>{h(E,a)})})},e);l=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),o={id:t,observer:i,elements:r},C.set(t,o)}return o}function J(e,t,o={},r=z){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const x=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:typeof o.threshold=="number"?o.threshold:0,time:0,boundingClientRect:x,intersectionRect:x,rootBounds:x}),()=>{}}const{id:l,observer:i,elements:c}=H(o),a=c.get(e)||[];return c.has(e)||c.set(e,a),a.push(t),i.observe(e),function(){a.splice(a.indexOf(t),1),a.length===0&&(c.delete(e),i.unobserve(e)),c.size===0&&(i.disconnect(),C.delete(l))}}function Q({threshold:e,delay:t,trackVisibility:o,rootMargin:r,root:l,triggerOnce:i,skip:c,initialInView:a,fallbackInView:x,onChange:E}={}){var h;const[w,g]=N.useState(null),_=N.useRef(E),u=N.useRef(a),[j,I]=N.useState({inView:!!a,entry:void 0});_.current=E,N.useEffect(()=>{if(u.current===void 0&&(u.current=a),c||!w)return;let v;return v=J(w,(D,b)=>{const M=u.current;u.current=D,!(M===void 0&&!D)&&(I({inView:D,entry:b}),_.current&&_.current(D,b),b.isIntersecting&&i&&v&&(v(),v=void 0))},{root:l,rootMargin:r,threshold:e,trackVisibility:o,delay:t},x),()=>{v&&v()}},[Array.isArray(e)?e.toString():e,w,l,r,i,c,o,x,t]);const y=(h=j.entry)==null?void 0:h.target,S=N.useRef(void 0);!w&&y&&!i&&!c&&S.current!==y&&(S.current=y,I({inView:!!a,entry:void 0}),u.current=a);const f=[g,j.inView,j.entry];return f.ref=f[0],f.inView=f[1],f.entry=f[2],f}const Y=async e=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get(`http://localhost:3001/api/ads/${e.ad_id}`,{params:{ad_id:e.ad_id}})).data.result}catch{}return R.axios.get(e.url,{params:{ad_id:e.ad_id}}).then(t=>t.data.result)},Z=60,ee={dedupingInterval:1e3*60*Z},se=e=>{const{data:t,error:o,isLoading:r,mutate:l}=R.useSWR(e?{url:`https://articles.media/api/ads/${e}`,ad_id:e}:null,Y,ee);return{data:t,error:o,isLoading:r,mutate:l}},q=6e4,P=Symbol.for("constructDateFrom");function te(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&P in e?e[P](t):e instanceof Date?new e.constructor(t):new Date(t)}function T(e,t){return te(e,e)}function re(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function ne(e,t){return+T(e)-+T(t)}function V(e,t,o){const r=ne(e,t)/q;return re(o?.roundingMethod)(r)}function L(e){return Math.trunc(e*q)}const oe=async e=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return R.axios.get(e.url,{params:{}}).then(t=>t.data)},B=60,ie={dedupingInterval:L(B),focusThrottleInterval:L(B)},ae=e=>{const{data:t,error:o,isLoading:r,mutate:l}=R.useSWR({url:"https://articles.media/api/ads"},oe,ie);return{data:t,error:o,isLoading:r,mutate:l}};function ce(e,t){return Math.floor(Math.random()*(t-e+1))+e}function le(e){const o=[],{data:r}=ae();let{previewMode:l}=e,i=e.previewData||{};const[c,a]=d.useState(null),[x,E]=d.useState(null),[h,w]=d.useState(null),[g,_]=d.useState(null),[u,j]=d.useState(0),[I,y]=d.useState(!1),[S,f]=d.useState(!1),[v,D]=d.useState(new Date),[b,M]=d.useState([]),{data:n}=se(c);d.useEffect(()=>{r&&r?.length>0&&!c&&(console.log("Ad Mounted or reduxAds changed"),a(e.ad_id||r[ce(0,r?.length-1)]?._id))},[r]),d.useEffect(()=>{},[n]),d.useEffect(()=>{n?.populated_promos&&u>=0&&_(n?.populated_promos[u])},[u,n]);function W(){f(!S)}const{ref:U,inView:k}=Q({threshold:0,triggerOnce:!0});function $(m){if(l&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),b.find(p=>p==m)){console.log("Already logged this event");return}R.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:m}}).then(function(p){M([...b,m]),console.log(p.data)}).catch(function(p){console.log(p)})}return d.useEffect(()=>{if(!l&&(console.log("inView",k),k&&c)){let m=[{ad_id:c,date:new Date().toString()},...o.filter(p=>{if(console.log(V(new Date,new Date(p.date))),V(new Date,new Date(p.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),p})];console.log("unexpiredRecentViews",m)}},[k,c]),s.jsxRuntimeExports.jsxs("div",{ref:U,className:"ad-wrap",style:{"--articles-ad-background-color":i.background_color||n?.background_color,"--articles-ad-font-color":i.font_color||n?.font_color,"--articles-ad-border-color":i.border_color||n?.border_color},children:[s.jsxRuntimeExports.jsx("div",{className:"ad",children:s.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[s.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:s.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),s.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[s.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[s.jsxRuntimeExports.jsx("div",{className:"logo",children:(i.logo?.location||n?.logo?.location)&&s.jsxRuntimeExports.jsx("img",{src:i?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${i?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),s.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),s.jsxRuntimeExports.jsx("img",{className:"photo",src:i?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${i.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),s.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[s.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[s.jsxRuntimeExports.jsx("div",{className:"detail",children:s.jsxRuntimeExports.jsx("span",{className:"h4",children:i?.business||n?.business})}),s.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[s.jsxRuntimeExports.jsxs("div",{className:"detail",children:[s.jsxRuntimeExports.jsx("span",{className:"icon",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),s.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),s.jsxRuntimeExports.jsxs("div",{className:"detail",children:[s.jsxRuntimeExports.jsx("span",{className:"icon",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),s.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&s.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),s.jsxRuntimeExports.jsx("div",{className:"short-description",children:i?.description||n?.description})]})]}),(!1)?.roles?.isDev&&n?.populated_promos?.length>0&&s.jsxRuntimeExports.jsxs("div",{children:[g&&s.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:g&&s.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:[s.jsxRuntimeExports.jsxs("div",{className:"",children:[s.jsxRuntimeExports.jsx("div",{children:g.title}),s.jsxRuntimeExports.jsx("div",{className:"small",children:s.jsxRuntimeExports.jsx("div",{className:"small",children:g.details})})]}),s.jsxRuntimeExports.jsx(X.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),y(!0)},children:"Save"})]},g._id)}),s.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[s.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),s.jsxRuntimeExports.jsxs("div",{className:"controls",children:[s.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{u==0?j(n?.populated_promos?.length-1):j(m=>m-1)}}),n?.populated_promos?.map((m,p)=>s.jsxRuntimeExports.jsx("i",{className:`fa-square ${p==u?"fad":"fas"}`},m._id)),s.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{u==n?.populated_promos?.length-1?j(0):j(m=>m+1)}})]})]})]}),s.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),s.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[s.jsxRuntimeExports.jsx("div",{onClick:()=>{W(),$("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),s.jsxRuntimeExports.jsx("span",{className:"px-4"}),s.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:()=>$("Website"),children:s.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]})}),!l&&s.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:i.background_color||n?.background_color,color:i.font_color||n?.font_color,borderColor:i.border_color||n?.border_color},children:s.jsxRuntimeExports.jsxs("div",{className:"small d-block w-100 text-center",children:[s.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const de=d.memo(le);module.exports=de;
1
+ "use strict";const s=require("./jsx-runtime-nZSsnGb7.cjs"),l=require("react"),R=require("./index-CqsCVLvJ.cjs"),X=require("./Button-BVYvDTtH.cjs");function z(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const N=z(l);var C=new Map,A=new WeakMap,O=0,F;function K(e){return e?(A.has(e)||(O+=1,A.set(e,O.toString())),A.get(e)):"0"}function G(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?K(e.root):e[t]}`).toString()}function H(e){const t=G(e);let o=C.get(t);if(!o){const r=new Map;let d;const i=new IntersectionObserver(c=>{c.forEach(a=>{var x;const E=a.isIntersecting&&d.some(h=>a.intersectionRatio>=h);e.trackVisibility&&typeof a.isVisible>"u"&&(a.isVisible=E),(x=r.get(a.target))==null||x.forEach(h=>{h(E,a)})})},e);d=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),o={id:t,observer:i,elements:r},C.set(t,o)}return o}function J(e,t,o={},r=F){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const x=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:typeof o.threshold=="number"?o.threshold:0,time:0,boundingClientRect:x,intersectionRect:x,rootBounds:x}),()=>{}}const{id:d,observer:i,elements:c}=H(o),a=c.get(e)||[];return c.has(e)||c.set(e,a),a.push(t),i.observe(e),function(){a.splice(a.indexOf(t),1),a.length===0&&(c.delete(e),i.unobserve(e)),c.size===0&&(i.disconnect(),C.delete(d))}}function Q({threshold:e,delay:t,trackVisibility:o,rootMargin:r,root:d,triggerOnce:i,skip:c,initialInView:a,fallbackInView:x,onChange:E}={}){var h;const[w,g]=N.useState(null),_=N.useRef(E),u=N.useRef(a),[j,I]=N.useState({inView:!!a,entry:void 0});_.current=E,N.useEffect(()=>{if(u.current===void 0&&(u.current=a),c||!w)return;let v;return v=J(w,(S,b)=>{const M=u.current;u.current=S,!(M===void 0&&!S)&&(I({inView:S,entry:b}),_.current&&_.current(S,b),b.isIntersecting&&i&&v&&(v(),v=void 0))},{root:d,rootMargin:r,threshold:e,trackVisibility:o,delay:t},x),()=>{v&&v()}},[Array.isArray(e)?e.toString():e,w,d,r,i,c,o,x,t]);const y=(h=j.entry)==null?void 0:h.target,D=N.useRef(void 0);!w&&y&&!i&&!c&&D.current!==y&&(D.current=y,I({inView:!!a,entry:void 0}),u.current=a);const f=[g,j.inView,j.entry];return f.ref=f[0],f.inView=f[1],f.entry=f[2],f}const Y=async e=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get(`http://localhost:3001/api/ads/${e.ad_id}`,{params:{ad_id:e.ad_id}})).data.result}catch{}return R.axios.get(e.url,{params:{ad_id:e.ad_id}}).then(t=>t.data.result)},Z=60,ee={dedupingInterval:1e3*60*Z},se=e=>{const{data:t,error:o,isLoading:r,mutate:d}=R.useSWR(e?{url:`https://articles.media/api/ads/${e}`,ad_id:e}:null,Y,ee);return{data:t,error:o,isLoading:r,mutate:d}},q=6e4,P=Symbol.for("constructDateFrom");function te(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&P in e?e[P](t):e instanceof Date?new e.constructor(t):new Date(t)}function T(e,t){return te(e,e)}function re(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function ne(e,t){return+T(e)-+T(t)}function V(e,t,o){const r=ne(e,t)/q;return re(o?.roundingMethod)(r)}function L(e){return Math.trunc(e*q)}const oe=async e=>{if(process.env.NODE_ENV==="development")try{return(await R.axios.get("http://localhost:3001/api/ads",{params:{}})).data}catch{}return R.axios.get(e.url,{params:{}}).then(t=>t.data)},B=60,ie={dedupingInterval:L(B),focusThrottleInterval:L(B)},ae=e=>{const{data:t,error:o,isLoading:r,mutate:d}=R.useSWR({url:"https://articles.media/api/ads"},oe,ie);return{data:t,error:o,isLoading:r,mutate:d}},ce=l.lazy(()=>Promise.resolve().then(()=>require("./AdDetailsModal-BCRLBkc_.cjs")));function le(e,t){return Math.floor(Math.random()*(t-e+1))+e}function de(e){const o=[],{data:r}=ae();let{previewMode:d}=e,i=e.previewData||{};const[c,a]=l.useState(null),[x,E]=l.useState(null),[h,w]=l.useState(null),[g,_]=l.useState(null),[u,j]=l.useState(0),[I,y]=l.useState(!1),[D,f]=l.useState(!1),[v,S]=l.useState(new Date),[b,M]=l.useState([]),{data:n}=se(c);l.useEffect(()=>{r&&r?.length>0&&!c&&(console.log("Ad Mounted or reduxAds changed"),a(e.ad_id||r[le(0,r?.length-1)]?._id))},[r]),l.useEffect(()=>{},[n]),l.useEffect(()=>{n?.populated_promos&&u>=0&&_(n?.populated_promos[u])},[u,n]);function W(){f(!D)}const{ref:U,inView:k}=Q({threshold:0,triggerOnce:!0});function $(m){if(d&&console.log("Preventing this event from being logged as this ad is being shown in preview mode."),b.find(p=>p==m)){console.log("Already logged this event");return}R.axios.get("/api/ads/event",{params:{ad_id:n?._id,event:m}}).then(function(p){M([...b,m]),console.log(p.data)}).catch(function(p){console.log(p)})}return l.useEffect(()=>{if(!d&&(console.log("inView",k),k&&c)){let m=[{ad_id:c,date:new Date().toString()},...o.filter(p=>{if(console.log(V(new Date,new Date(p.date))),V(new Date,new Date(p.date))>5){console.log("adsViewed - Remove Old Ad View Object");return}else return console.log("adsViewed - Keep Ad View Object"),p})];console.log("unexpiredRecentViews",m)}},[k,c]),s.jsxRuntimeExports.jsxs("div",{ref:U,className:"ad-wrap",style:{"--articles-ad-background-color":i.background_color||n?.background_color,"--articles-ad-font-color":i.font_color||n?.font_color,"--articles-ad-border-color":i.border_color||n?.border_color},children:[D&&s.jsxRuntimeExports.jsx(ce,{setModalShow:f,ad:n,previewData:i}),s.jsxRuntimeExports.jsx("div",{className:"ad",children:s.jsxRuntimeExports.jsxs("div",{className:"main-panel",children:[s.jsxRuntimeExports.jsx("div",{className:"ad-warning flex-header",children:s.jsxRuntimeExports.jsxs("div",{className:"",children:[n?.city&&"Local"," Advertisement"]})}),s.jsxRuntimeExports.jsxs("div",{className:"content-wrap",children:[s.jsxRuntimeExports.jsxs("div",{className:"photo-banner",children:[s.jsxRuntimeExports.jsx("div",{className:"logo",children:(i.logo?.location||n?.logo?.location)&&s.jsxRuntimeExports.jsx("img",{src:i?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${i?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}`,alt:""})}),s.jsxRuntimeExports.jsx("div",{className:"icon d-none",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-mug-hot"})}),s.jsxRuntimeExports.jsx("img",{className:"photo",src:i?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${i.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${n?.background?.key}`,alt:""})]}),s.jsxRuntimeExports.jsxs("div",{className:"details-wrap",children:[s.jsxRuntimeExports.jsxs("div",{className:"detail-title",children:[s.jsxRuntimeExports.jsx("div",{className:"detail",children:s.jsxRuntimeExports.jsx("span",{className:"h4",children:i?.business||n?.business})}),s.jsxRuntimeExports.jsxs("div",{className:"flex flex-column d-none",children:[s.jsxRuntimeExports.jsxs("div",{className:"detail",children:[s.jsxRuntimeExports.jsx("span",{className:"icon",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-search-location"})}),s.jsxRuntimeExports.jsxs("span",{children:[n?.city,", ",n?.state]})]}),s.jsxRuntimeExports.jsxs("div",{className:"detail",children:[s.jsxRuntimeExports.jsx("span",{className:"icon",children:s.jsxRuntimeExports.jsx("i",{className:"fas fa-clock me-2"})}),s.jsxRuntimeExports.jsx("span",{children:"6:30AM–8PM"})]})]})]}),n?.city&&s.jsxRuntimeExports.jsx("div",{className:"details mb-3 d-none"}),s.jsxRuntimeExports.jsx("div",{className:"short-description",children:i?.description||n?.description})]})]}),(!1)?.roles?.isDev&&n?.populated_promos?.length>0&&s.jsxRuntimeExports.jsxs("div",{children:[g&&s.jsxRuntimeExports.jsx("div",{className:"promos-wrap",children:g&&s.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:[s.jsxRuntimeExports.jsxs("div",{className:"",children:[s.jsxRuntimeExports.jsx("div",{children:g.title}),s.jsxRuntimeExports.jsx("div",{className:"small",children:s.jsxRuntimeExports.jsx("div",{className:"small",children:g.details})})]}),s.jsxRuntimeExports.jsx(X.ArticlesButton,{className:"px-3",small:!0,onClick:()=>{console.log("Load Save Modal"),y(!0)},children:"Save"})]},g._id)}),s.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between",children:[s.jsxRuntimeExports.jsxs("div",{className:"px-2",children:[n?.populated_promos?.length," Promos Active"]}),s.jsxRuntimeExports.jsxs("div",{className:"controls",children:[s.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-left",type:"button",onClick:()=>{u==0?j(n?.populated_promos?.length-1):j(m=>m-1)}}),n?.populated_promos?.map((m,p)=>s.jsxRuntimeExports.jsx("i",{className:`fa-square ${p==u?"fad":"fas"}`},m._id)),s.jsxRuntimeExports.jsx("i",{className:"fad fa-arrow-circle-right",type:"button",onClick:()=>{u==n?.populated_promos?.length-1?j(0):j(m=>m+1)}})]})]})]}),s.jsxRuntimeExports.jsx("hr",{style:{borderColor:"white"},className:"mt-auto mb-0"}),s.jsxRuntimeExports.jsxs("div",{className:"action-wrap d-flex justify-content-lg-between px-3 py-2",children:[s.jsxRuntimeExports.jsx("div",{onClick:()=>{W(),$("Details")},className:"action flex-grow-1 flex-shrink-0",children:"Details"}),s.jsxRuntimeExports.jsx("span",{className:"px-4"}),s.jsxRuntimeExports.jsx("a",{className:"action flex-grow-1 flex-shrink-0",href:n?.website,target:"_blank",rel:"noreferrer",onClick:()=>$("Website"),children:s.jsxRuntimeExports.jsx("div",{children:"Website"})})]})]})}),!d&&s.jsxRuntimeExports.jsx("div",{className:"advertise-with-us p-1",style:{backgroundColor:i.background_color||n?.background_color,color:i.font_color||n?.font_color,borderColor:i.border_color||n?.border_color},children:s.jsxRuntimeExports.jsxs("div",{className:"small d-block w-100 text-center",children:[s.jsxRuntimeExports.jsx("i",{className:"fas fa-share me-1"}),"Advertise with Articles Media!"]})})]})}const ue=l.memo(de);module.exports=ue;
package/dist/Ad.js CHANGED
@@ -1,45 +1,45 @@
1
1
  import { j as s } from "./jsx-runtime-tc70JA_2.js";
2
2
  import * as w from "react";
3
- import { memo as z, useState as p, useEffect as M } from "react";
4
- import { u as W, a as I } from "./index-CsgQIn35.js";
5
- import { A as K } from "./Button-g7fiSVpz.js";
6
- var $ = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new WeakMap(), P = 0, G;
7
- function H(e) {
3
+ import { lazy as q, memo as K, useState as p, useEffect as R } from "react";
4
+ import { u as W, a as M } from "./index-CsgQIn35.js";
5
+ import { A as G } from "./Button-B5nVYPMZ.js";
6
+ var $ = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new WeakMap(), P = 0, H;
7
+ function J(e) {
8
8
  return e ? (k.has(e) || (P += 1, k.set(e, P.toString())), k.get(e)) : "0";
9
9
  }
10
- function J(e) {
10
+ function Q(e) {
11
11
  return Object.keys(e).sort().filter(
12
12
  (t) => e[t] !== void 0
13
- ).map((t) => `${t}_${t === "root" ? H(e.root) : e[t]}`).toString();
13
+ ).map((t) => `${t}_${t === "root" ? J(e.root) : e[t]}`).toString();
14
14
  }
15
- function Q(e) {
16
- const t = J(e);
15
+ function Y(e) {
16
+ const t = Q(e);
17
17
  let a = $.get(t);
18
18
  if (!a) {
19
- const n = /* @__PURE__ */ new Map();
19
+ const o = /* @__PURE__ */ new Map();
20
20
  let l;
21
- const o = new IntersectionObserver((c) => {
21
+ const n = new IntersectionObserver((c) => {
22
22
  c.forEach((i) => {
23
23
  var u;
24
24
  const N = i.isIntersecting && l.some((v) => i.intersectionRatio >= v);
25
- e.trackVisibility && typeof i.isVisible > "u" && (i.isVisible = N), (u = n.get(i.target)) == null || u.forEach((v) => {
25
+ e.trackVisibility && typeof i.isVisible > "u" && (i.isVisible = N), (u = o.get(i.target)) == null || u.forEach((v) => {
26
26
  v(N, i);
27
27
  });
28
28
  });
29
29
  }, e);
30
- l = o.thresholds || (Array.isArray(e.threshold) ? e.threshold : [e.threshold || 0]), a = {
30
+ l = n.thresholds || (Array.isArray(e.threshold) ? e.threshold : [e.threshold || 0]), a = {
31
31
  id: t,
32
- observer: o,
33
- elements: n
32
+ observer: n,
33
+ elements: o
34
34
  }, $.set(t, a);
35
35
  }
36
36
  return a;
37
37
  }
38
- function Y(e, t, a = {}, n = G) {
39
- if (typeof window.IntersectionObserver > "u" && n !== void 0) {
38
+ function Z(e, t, a = {}, o = H) {
39
+ if (typeof window.IntersectionObserver > "u" && o !== void 0) {
40
40
  const u = e.getBoundingClientRect();
41
- return t(n, {
42
- isIntersecting: n,
41
+ return t(o, {
42
+ isIntersecting: o,
43
43
  target: e,
44
44
  intersectionRatio: typeof a.threshold == "number" ? a.threshold : 0,
45
45
  time: 0,
@@ -49,18 +49,18 @@ function Y(e, t, a = {}, n = G) {
49
49
  }), () => {
50
50
  };
51
51
  }
52
- const { id: l, observer: o, elements: c } = Q(a), i = c.get(e) || [];
53
- return c.has(e) || c.set(e, i), i.push(t), o.observe(e), function() {
54
- i.splice(i.indexOf(t), 1), i.length === 0 && (c.delete(e), o.unobserve(e)), c.size === 0 && (o.disconnect(), $.delete(l));
52
+ const { id: l, observer: n, elements: c } = Y(a), i = c.get(e) || [];
53
+ return c.has(e) || c.set(e, i), i.push(t), n.observe(e), function() {
54
+ i.splice(i.indexOf(t), 1), i.length === 0 && (c.delete(e), n.unobserve(e)), c.size === 0 && (n.disconnect(), $.delete(l));
55
55
  };
56
56
  }
57
- function Z({
57
+ function ee({
58
58
  threshold: e,
59
59
  delay: t,
60
60
  trackVisibility: a,
61
- rootMargin: n,
61
+ rootMargin: o,
62
62
  root: l,
63
- triggerOnce: o,
63
+ triggerOnce: n,
64
64
  skip: c,
65
65
  initialInView: i,
66
66
  fallbackInView: u,
@@ -75,18 +75,18 @@ function Z({
75
75
  () => {
76
76
  if (d.current === void 0 && (d.current = i), c || !_) return;
77
77
  let j;
78
- return j = Y(
78
+ return j = Z(
79
79
  _,
80
- (A, b) => {
80
+ (I, b) => {
81
81
  const C = d.current;
82
- d.current = A, !(C === void 0 && !A) && (E({
83
- inView: A,
82
+ d.current = I, !(C === void 0 && !I) && (E({
83
+ inView: I,
84
84
  entry: b
85
- }), y.current && y.current(A, b), b.isIntersecting && o && j && (j(), j = void 0));
85
+ }), y.current && y.current(I, b), b.isIntersecting && n && j && (j(), j = void 0));
86
86
  },
87
87
  {
88
88
  root: l,
89
- rootMargin: n,
89
+ rootMargin: o,
90
90
  threshold: e,
91
91
  // @ts-expect-error
92
92
  trackVisibility: a,
@@ -104,134 +104,134 @@ function Z({
104
104
  Array.isArray(e) ? e.toString() : e,
105
105
  _,
106
106
  l,
107
- n,
108
107
  o,
108
+ n,
109
109
  c,
110
110
  a,
111
111
  u,
112
112
  t
113
113
  ]
114
114
  );
115
- const D = (v = g.entry) == null ? void 0 : v.target, R = w.useRef(void 0);
116
- !_ && D && !o && !c && R.current !== D && (R.current = D, E({
115
+ const D = (v = g.entry) == null ? void 0 : v.target, A = w.useRef(void 0);
116
+ !_ && D && !n && !c && A.current !== D && (A.current = D, E({
117
117
  inView: !!i,
118
118
  entry: void 0
119
119
  }), d.current = i);
120
120
  const h = [x, g.inView, g.entry];
121
121
  return h.ref = h[0], h.inView = h[1], h.entry = h[2], h;
122
122
  }
123
- const ee = async (e) => {
123
+ const se = async (e) => {
124
124
  if (process.env.NODE_ENV === "development")
125
125
  try {
126
- return (await I.get(`http://localhost:3001/api/ads/${e.ad_id}`, {
126
+ return (await M.get(`http://localhost:3001/api/ads/${e.ad_id}`, {
127
127
  params: {
128
128
  ad_id: e.ad_id
129
129
  }
130
130
  })).data.result;
131
131
  } catch {
132
132
  }
133
- return I.get(e.url, {
133
+ return M.get(e.url, {
134
134
  params: {
135
135
  ad_id: e.ad_id
136
136
  }
137
137
  }).then((t) => t.data.result);
138
- }, se = 60, te = {
139
- dedupingInterval: 1e3 * 60 * se
138
+ }, te = 60, re = {
139
+ dedupingInterval: 1e3 * 60 * te
140
140
  // keepPreviousData: true,
141
141
  // fallbackData: []
142
- }, re = (e) => {
143
- const { data: t, error: a, isLoading: n, mutate: l } = W(
142
+ }, ne = (e) => {
143
+ const { data: t, error: a, isLoading: o, mutate: l } = W(
144
144
  e ? {
145
145
  url: `https://articles.media/api/ads/${e}`,
146
146
  ad_id: e
147
147
  } : null,
148
- ee,
149
- te
148
+ se,
149
+ re
150
150
  );
151
151
  return {
152
152
  data: t,
153
153
  error: a,
154
- isLoading: n,
154
+ isLoading: o,
155
155
  mutate: l
156
156
  };
157
157
  }, X = 6e4, T = /* @__PURE__ */ Symbol.for("constructDateFrom");
158
- function ne(e, t) {
158
+ function oe(e, t) {
159
159
  return typeof e == "function" ? e(t) : e && typeof e == "object" && T in e ? e[T](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
160
160
  }
161
161
  function L(e, t) {
162
- return ne(e, e);
162
+ return oe(e, e);
163
163
  }
164
- function oe(e) {
164
+ function ae(e) {
165
165
  return (t) => {
166
- const n = (e ? Math[e] : Math.trunc)(t);
167
- return n === 0 ? 0 : n;
166
+ const o = (e ? Math[e] : Math.trunc)(t);
167
+ return o === 0 ? 0 : o;
168
168
  };
169
169
  }
170
- function ae(e, t) {
170
+ function ie(e, t) {
171
171
  return +L(e) - +L(t);
172
172
  }
173
173
  function O(e, t, a) {
174
- const n = ae(e, t) / X;
175
- return oe(a?.roundingMethod)(n);
174
+ const o = ie(e, t) / X;
175
+ return ae(a?.roundingMethod)(o);
176
176
  }
177
177
  function B(e) {
178
178
  return Math.trunc(e * X);
179
179
  }
180
- const ie = async (e) => {
180
+ const ce = async (e) => {
181
181
  if (process.env.NODE_ENV === "development")
182
182
  try {
183
- return (await I.get("http://localhost:3001/api/ads", {
183
+ return (await M.get("http://localhost:3001/api/ads", {
184
184
  params: {
185
185
  // ad_id: data.ad_id
186
186
  }
187
187
  })).data;
188
188
  } catch {
189
189
  }
190
- return I.get(e.url, {
190
+ return M.get(e.url, {
191
191
  params: {
192
192
  // ad_id: data.ad_id
193
193
  }
194
194
  }).then((t) => t.data);
195
- }, U = 60, ce = {
195
+ }, U = 60, le = {
196
196
  dedupingInterval: B(U),
197
197
  focusThrottleInterval: B(U)
198
198
  // keepPreviousData: true,
199
199
  // fallbackData: []
200
- }, le = (e) => {
201
- const { data: t, error: a, isLoading: n, mutate: l } = W(
200
+ }, de = (e) => {
201
+ const { data: t, error: a, isLoading: o, mutate: l } = W(
202
202
  {
203
203
  url: "https://articles.media/api/ads"
204
204
  // ad_id
205
205
  },
206
- ie,
207
- ce
206
+ ce,
207
+ le
208
208
  );
209
209
  return {
210
210
  data: t,
211
211
  error: a,
212
- isLoading: n,
212
+ isLoading: o,
213
213
  mutate: l
214
214
  };
215
- };
216
- function de(e, t) {
215
+ }, ue = q(() => import("./AdDetailsModal-BOLzA3ZL.js"));
216
+ function fe(e, t) {
217
217
  return Math.floor(Math.random() * (t - e + 1)) + e;
218
218
  }
219
- function ue(e) {
219
+ function me(e) {
220
220
  const a = [], {
221
- data: n
222
- } = le();
223
- let { previewMode: l } = e, o = e.previewData || {};
224
- const [c, i] = p(null), [u, N] = p(null), [v, _] = p(null), [x, y] = p(null), [d, g] = p(0), [E, D] = p(!1), [R, h] = p(!1), [j, A] = p(/* @__PURE__ */ new Date()), [b, C] = p([]), { data: r } = re(c);
225
- M(() => {
226
- n && n?.length > 0 && !c && (console.log("Ad Mounted or reduxAds changed"), i(e.ad_id || n[de(0, n?.length - 1)]?._id));
227
- }, [n]), M(() => {
228
- }, [r]), M(() => {
221
+ data: o
222
+ } = de();
223
+ let { previewMode: l } = e, n = e.previewData || {};
224
+ const [c, i] = p(null), [u, N] = p(null), [v, _] = p(null), [x, y] = p(null), [d, g] = p(0), [E, D] = p(!1), [A, h] = p(!1), [j, I] = p(/* @__PURE__ */ new Date()), [b, C] = p([]), { data: r } = ne(c);
225
+ R(() => {
226
+ o && o?.length > 0 && !c && (console.log("Ad Mounted or reduxAds changed"), i(e.ad_id || o[fe(0, o?.length - 1)]?._id));
227
+ }, [o]), R(() => {
228
+ }, [r]), R(() => {
229
229
  r?.populated_promos && d >= 0 && y(r?.populated_promos[d]);
230
230
  }, [d, r]);
231
231
  function F() {
232
- h(!R);
232
+ h(!A);
233
233
  }
234
- const { ref: q, inView: S } = Z({
234
+ const { ref: z, inView: S } = ee({
235
235
  /* Optional options */
236
236
  threshold: 0,
237
237
  triggerOnce: !0
@@ -241,7 +241,7 @@ function ue(e) {
241
241
  console.log("Already logged this event");
242
242
  return;
243
243
  }
244
- I.get("/api/ads/event", {
244
+ M.get("/api/ads/event", {
245
245
  params: {
246
246
  ad_id: r?._id,
247
247
  event: f
@@ -252,7 +252,7 @@ function ue(e) {
252
252
  console.log(m);
253
253
  });
254
254
  }
255
- return M(() => {
255
+ return R(() => {
256
256
  if (!l && (console.log("inView", S), S && c)) {
257
257
  let f = [
258
258
  {
@@ -274,14 +274,22 @@ function ue(e) {
274
274
  }, [S, c]), /* @__PURE__ */ s.jsxs(
275
275
  "div",
276
276
  {
277
- ref: q,
277
+ ref: z,
278
278
  className: "ad-wrap",
279
279
  style: {
280
- "--articles-ad-background-color": o.background_color || r?.background_color,
281
- "--articles-ad-font-color": o.font_color || r?.font_color,
282
- "--articles-ad-border-color": o.border_color || r?.border_color
280
+ "--articles-ad-background-color": n.background_color || r?.background_color,
281
+ "--articles-ad-font-color": n.font_color || r?.font_color,
282
+ "--articles-ad-border-color": n.border_color || r?.border_color
283
283
  },
284
284
  children: [
285
+ A && /* @__PURE__ */ s.jsx(
286
+ ue,
287
+ {
288
+ setModalShow: h,
289
+ ad: r,
290
+ previewData: n
291
+ }
292
+ ),
285
293
  /* @__PURE__ */ s.jsx(
286
294
  "div",
287
295
  {
@@ -297,10 +305,10 @@ function ue(e) {
297
305
  ] }) }),
298
306
  /* @__PURE__ */ s.jsxs("div", { className: "content-wrap", children: [
299
307
  /* @__PURE__ */ s.jsxs("div", { className: "photo-banner", children: [
300
- /* @__PURE__ */ s.jsx("div", { className: "logo", children: (o.logo?.location || r?.logo?.location) && /* @__PURE__ */ s.jsx(
308
+ /* @__PURE__ */ s.jsx("div", { className: "logo", children: (n.logo?.location || r?.logo?.location) && /* @__PURE__ */ s.jsx(
301
309
  "img",
302
310
  {
303
- src: o?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${o?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.logo?.key}`,
311
+ src: n?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.logo?.key}`,
304
312
  alt: ""
305
313
  }
306
314
  ) }),
@@ -309,14 +317,14 @@ function ue(e) {
309
317
  "img",
310
318
  {
311
319
  className: "photo",
312
- src: o?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${o.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.background?.key}`,
320
+ src: n?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${n.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.background?.key}`,
313
321
  alt: ""
314
322
  }
315
323
  )
316
324
  ] }),
317
325
  /* @__PURE__ */ s.jsxs("div", { className: "details-wrap", children: [
318
326
  /* @__PURE__ */ s.jsxs("div", { className: "detail-title", children: [
319
- /* @__PURE__ */ s.jsx("div", { className: "detail", children: /* @__PURE__ */ s.jsx("span", { className: "h4", children: o?.business || r?.business }) }),
327
+ /* @__PURE__ */ s.jsx("div", { className: "detail", children: /* @__PURE__ */ s.jsx("span", { className: "h4", children: n?.business || r?.business }) }),
320
328
  /* @__PURE__ */ s.jsxs("div", { className: "flex flex-column d-none", children: [
321
329
  /* @__PURE__ */ s.jsxs("div", { className: "detail", children: [
322
330
  /* @__PURE__ */ s.jsx("span", { className: "icon", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-search-location" }) }),
@@ -333,7 +341,7 @@ function ue(e) {
333
341
  ] })
334
342
  ] }),
335
343
  r?.city && /* @__PURE__ */ s.jsx("div", { className: "details mb-3 d-none" }),
336
- /* @__PURE__ */ s.jsx("div", { className: "short-description", children: o?.description || r?.description })
344
+ /* @__PURE__ */ s.jsx("div", { className: "short-description", children: n?.description || r?.description })
337
345
  ] })
338
346
  ] }),
339
347
  (!1)?.roles?.isDev && r?.populated_promos?.length > 0 && /* @__PURE__ */ s.jsxs("div", { children: [
@@ -347,7 +355,7 @@ function ue(e) {
347
355
  /* @__PURE__ */ s.jsx("div", { className: "small", children: /* @__PURE__ */ s.jsx("div", { className: "small", children: x.details }) })
348
356
  ] }),
349
357
  /* @__PURE__ */ s.jsx(
350
- K,
358
+ G,
351
359
  {
352
360
  className: "px-3",
353
361
  small: !0,
@@ -435,9 +443,9 @@ function ue(e) {
435
443
  className: "advertise-with-us p-1",
436
444
  style: {
437
445
  // ...(props.previewData ? props.previewData.background_color : ad?.background_color),
438
- backgroundColor: o.background_color || r?.background_color,
439
- color: o.font_color || r?.font_color,
440
- borderColor: o.border_color || r?.border_color
446
+ backgroundColor: n.background_color || r?.background_color,
447
+ color: n.font_color || r?.font_color,
448
+ borderColor: n.border_color || r?.border_color
441
449
  },
442
450
  children: /* @__PURE__ */ s.jsxs(
443
451
  "div",
@@ -455,7 +463,7 @@ function ue(e) {
455
463
  }
456
464
  );
457
465
  }
458
- const ge = z(ue);
466
+ const xe = K(me);
459
467
  export {
460
- ge as default
468
+ xe as default
461
469
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-nZSsnGb7.cjs"),o=require("react"),t=require("./Modal-BNCxuVnD.cjs"),l=require("./Button-BVYvDTtH.cjs");function x(r){const{href:n,children:e,newPage:a,...i}=r;return s.jsxRuntimeExports.jsx("a",{href:n,...i,...a&&{target:"_blank",rel:"noopener noreferrer"},children:e})}function d(r){let{setModalShow:n,ad:e,previewData:a}=r;o.useEffect(()=>{console.log("Mounted")},[]);const i=()=>{n(!1)};return s.jsxRuntimeExports.jsx("div",{children:s.jsxRuntimeExports.jsxs(t.Modal,{show:!0,backdropClassName:"ad-details-modal-backdrop",className:"articles-modal",centered:!0,onHide:i,size:"md",children:[s.jsxRuntimeExports.jsx(t.Modal.Header,{className:"align-items-center",closeButton:!0,children:s.jsxRuntimeExports.jsx(t.Modal.Title,{children:"Ad Details"})}),s.jsxRuntimeExports.jsxs(t.Modal.Body,{className:"",children:[s.jsxRuntimeExports.jsxs("p",{className:"mb-1",children:["Advertiser: ",s.jsxRuntimeExports.jsx("b",{children:e.business})]}),s.jsxRuntimeExports.jsxs("p",{className:"mb-0",children:["Ad ID: ",s.jsxRuntimeExports.jsx("b",{children:a?._id||e._id})]}),s.jsxRuntimeExports.jsx("hr",{}),s.jsxRuntimeExports.jsx("div",{className:"mb-1",children:"This ad is being shown to you for the following reasons"}),e.city?s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:"h4 mb-1",children:e.business}),s.jsxRuntimeExports.jsx("div",{children:"Is advertising to all zip codes within a"}),s.jsxRuntimeExports.jsx("span",{children:s.jsxRuntimeExports.jsx("div",{className:"badge bg-light shadow-articles",children:"15 Mile Radius"})}),s.jsxRuntimeExports.jsx("div",{children:"of it's business"}),s.jsxRuntimeExports.jsx("hr",{className:"border w-50 border-white"}),s.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center",children:[s.jsxRuntimeExports.jsx("div",{children:"Your Zip code"}),s.jsxRuntimeExports.jsx("div",{className:"badge bg-light shadow-articles ms-2",children:"12524"}),s.jsxRuntimeExports.jsx("div",{className:"ms-2",children:"is"}),s.jsxRuntimeExports.jsx("div",{className:"badge bg-light shadow-articles ms-2",children:"1.7 miles away"})]})]}):s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:"h4 mb-1",children:e.business}),s.jsxRuntimeExports.jsx("div",{children:"Is advertising to all users"})]}),s.jsxRuntimeExports.jsx("div",{className:"grow"}),s.jsxRuntimeExports.jsx("hr",{className:"w-100"}),s.jsxRuntimeExports.jsx("div",{className:"reason lh-sm mb-2",children:"Ads we display to you will always be transparent as to why you are seeing them."}),s.jsxRuntimeExports.jsx(x,{href:"https://articles.media/settings/account",newPage:!0,className:"",children:s.jsxRuntimeExports.jsx(l.ArticlesButton,{small:!0,children:"Settings"})})]}),s.jsxRuntimeExports.jsx(t.Modal.Footer,{className:"d-flex justify-content-center",children:s.jsxRuntimeExports.jsx(l.ArticlesButton,{variant:"articles",onClick:i,children:"Close"})})]})})}exports.default=d;
@@ -0,0 +1,94 @@
1
+ import { j as s } from "./jsx-runtime-tc70JA_2.js";
2
+ import { useEffect as t } from "react";
3
+ import { M as i } from "./Modal-BoOxjQvF.js";
4
+ import { A as n } from "./Button-B5nVYPMZ.js";
5
+ function c(l) {
6
+ const { href: r, children: e, newPage: d, ...a } = l;
7
+ return /* @__PURE__ */ s.jsx(
8
+ "a",
9
+ {
10
+ href: r,
11
+ ...a,
12
+ ...d && { target: "_blank", rel: "noopener noreferrer" },
13
+ children: e
14
+ }
15
+ );
16
+ }
17
+ function j(l) {
18
+ let { setModalShow: r, ad: e, previewData: d } = l;
19
+ t(() => {
20
+ console.log("Mounted");
21
+ }, []);
22
+ const a = () => {
23
+ r(!1);
24
+ };
25
+ return /* @__PURE__ */ s.jsx("div", { children: /* @__PURE__ */ s.jsxs(
26
+ i,
27
+ {
28
+ show: !0,
29
+ backdropClassName: "ad-details-modal-backdrop",
30
+ className: "articles-modal",
31
+ centered: !0,
32
+ onHide: a,
33
+ size: "md",
34
+ children: [
35
+ /* @__PURE__ */ s.jsx(i.Header, { className: "align-items-center", closeButton: !0, children: /* @__PURE__ */ s.jsx(i.Title, { children: "Ad Details" }) }),
36
+ /* @__PURE__ */ s.jsxs(
37
+ i.Body,
38
+ {
39
+ className: "",
40
+ children: [
41
+ /* @__PURE__ */ s.jsxs("p", { className: "mb-1", children: [
42
+ "Advertiser: ",
43
+ /* @__PURE__ */ s.jsx("b", { children: e.business })
44
+ ] }),
45
+ /* @__PURE__ */ s.jsxs("p", { className: "mb-0", children: [
46
+ "Ad ID: ",
47
+ /* @__PURE__ */ s.jsx("b", { children: d?._id || e._id })
48
+ ] }),
49
+ /* @__PURE__ */ s.jsx("hr", {}),
50
+ /* @__PURE__ */ s.jsx("div", { className: "mb-1", children: "This ad is being shown to you for the following reasons" }),
51
+ e.city ? /* @__PURE__ */ s.jsxs("div", { children: [
52
+ /* @__PURE__ */ s.jsx("div", { className: "h4 mb-1", children: e.business }),
53
+ /* @__PURE__ */ s.jsx("div", { children: "Is advertising to all zip codes within a" }),
54
+ /* @__PURE__ */ s.jsx("span", { children: /* @__PURE__ */ s.jsx("div", { className: "badge bg-light shadow-articles", children: "15 Mile Radius" }) }),
55
+ /* @__PURE__ */ s.jsx("div", { children: "of it's business" }),
56
+ /* @__PURE__ */ s.jsx("hr", { className: "border w-50 border-white" }),
57
+ /* @__PURE__ */ s.jsxs("div", { className: "d-flex align-items-center", children: [
58
+ /* @__PURE__ */ s.jsx("div", { children: "Your Zip code" }),
59
+ /* @__PURE__ */ s.jsx("div", { className: "badge bg-light shadow-articles ms-2", children: "12524" }),
60
+ /* @__PURE__ */ s.jsx("div", { className: "ms-2", children: "is" }),
61
+ /* @__PURE__ */ s.jsx("div", { className: "badge bg-light shadow-articles ms-2", children: "1.7 miles away" })
62
+ ] })
63
+ ] }) : /* @__PURE__ */ s.jsxs("div", { children: [
64
+ /* @__PURE__ */ s.jsx("div", { className: "h4 mb-1", children: e.business }),
65
+ /* @__PURE__ */ s.jsx("div", { children: "Is advertising to all users" })
66
+ ] }),
67
+ /* @__PURE__ */ s.jsx("div", { className: "grow" }),
68
+ /* @__PURE__ */ s.jsx("hr", { className: "w-100" }),
69
+ /* @__PURE__ */ s.jsx("div", { className: "reason lh-sm mb-2", children: "Ads we display to you will always be transparent as to why you are seeing them." }),
70
+ /* @__PURE__ */ s.jsx(c, { href: "https://articles.media/settings/account", newPage: !0, className: "", children: /* @__PURE__ */ s.jsx(
71
+ n,
72
+ {
73
+ small: !0,
74
+ children: "Settings"
75
+ }
76
+ ) })
77
+ ]
78
+ }
79
+ ),
80
+ /* @__PURE__ */ s.jsx(i.Footer, { className: "d-flex justify-content-center", children: /* @__PURE__ */ s.jsx(
81
+ n,
82
+ {
83
+ variant: "articles",
84
+ onClick: a,
85
+ children: "Close"
86
+ }
87
+ ) })
88
+ ]
89
+ }
90
+ ) });
91
+ }
92
+ export {
93
+ j as default
94
+ };
@@ -1 +1 @@
1
- "use strict";const t=require("./jsx-runtime-Blz-RjDE.cjs"),s=require("react");function c({darkMode:r}){return s.useEffect(()=>{},[]),s.useEffect(()=>{const e=document.createElement("script");return e.src="https://accounts.articles.media/js/ad.js",e.async=!0,document.body.appendChild(e),()=>{document.body.removeChild(e)}},[]),t.jsxRuntimeExports.jsx("div",{className:"",children:t.jsxRuntimeExports.jsx("div",{className:"articles-media-ad"})})}module.exports=c;
1
+ "use strict";const t=require("./jsx-runtime-nZSsnGb7.cjs"),s=require("react");function c({darkMode:r}){return s.useEffect(()=>{},[]),s.useEffect(()=>{const e=document.createElement("script");return e.src="https://accounts.articles.media/js/ad.js",e.async=!0,document.body.appendChild(e),()=>{document.body.removeChild(e)}},[]),t.jsxRuntimeExports.jsx("div",{className:"",children:t.jsxRuntimeExports.jsx("div",{className:"articles-media-ad"})})}module.exports=c;
@@ -87,5 +87,7 @@ const A = /* @__PURE__ */ N(w), O = x((n, i) => {
87
87
  });
88
88
  O.displayName = "ArticlesButton";
89
89
  export {
90
- O as A
90
+ O as A,
91
+ A as c,
92
+ N as g
91
93
  };
@@ -0,0 +1 @@
1
+ "use strict";const S=require("./jsx-runtime-nZSsnGb7.cjs"),w=require("react");function f(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var u={exports:{}};var l;function A(){return l||(l=1,(function(s){(function(){var i={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var r=arguments[e];r&&(t=a(t,o(r)))}return t}function o(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var r in t)i.call(t,r)&&t[r]&&(e=a(e,r));return e}function a(t,e){return e?t?t+" "+e:t+e:t}s.exports?(n.default=n,s.exports=n):window.classNames=n})()})(u)),u.exports}var E=A();const p=f(E),m=w.forwardRef((s,i)=>{const{size:n,variant:o,style:a,small:t,large:e,onClick:r,className:c,disabled:d,active:b,type:y,onMouseDown:v,onMouseUp:h,onMouseLeave:j,onTouchStart:x,onTouchEnd:N,...O}=s;return S.jsxRuntimeExports.jsx("button",{ref:i,...y&&{type:"submit"},disabled:d,style:a,onMouseDown:v,onMouseUp:h,onMouseLeave:j,onTouchStart:x,onTouchEnd:N,className:p(`btn ${o?`btn-${o}`:"btn-articles"}`,{[c]:c,"btn-lg":e,"btn-sm":t,active:b,[`btn-${n}`]:n}),onClick:r,children:s.children})});m.displayName="ArticlesButton";exports.ArticlesButton=m;exports.classNames=p;exports.getDefaultExportFromCjs=f;
@@ -1 +1 @@
1
- "use strict";const e=require("./jsx-runtime-Blz-RjDE.cjs"),r=require("react"),d=require("./Button-CZyAJPvK.cjs"),l=require("./index-CqsCVLvJ.cjs"),j=async s=>{if(process.env.NODE_ENV==="development")try{return(await l.axios.get("http://localhost:3001/api/community/games/scoreboard",{params:{game:s.game}})).data}catch{}return l.axios.get(s.url,{params:{game:s.game}}).then(t=>t.data)},p={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},h=s=>{const{data:t,error:i,isLoading:c,isValidating:n,mutate:o}=l.useSWR(s?.game?{url:"https://articles.media/api/community/games/scoreboard",game:s.game}:null,j,p);return{data:t,error:i,isLoading:c,isValidating:n,mutate:o}};function f({game:s,reloadScoreboard:t,setReloadScoreboard:i}){const[c,n]=r.useState(!1),[o,E]=r.useState(!1),{data:m,mutate:x}=h({game:s});return r.useEffect(()=>{},[]),r.useEffect(()=>{t&&(i(!1),x())},[t]),e.jsxRuntimeExports.jsx("div",{className:"scoreboard",children: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(d.ArticlesButton,{onClick:()=>{x()},small:!0,children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-0"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card-body p-0",children:[(m?.length||0)==0&&e.jsxRuntimeExports.jsx("div",{className:"small p-2",children:"No scores yet"}),m?.map((a,u)=>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:u+1}),e.jsxRuntimeExports.jsx("div",{className:"lh-sm"})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("h5",{className:"mb-0",children:a.score||a.total})})]}),a.last_play&&a.public_last_play&&e.jsxRuntimeExports.jsxs("small",{className:"mt-1",style:{fontSize:"0.75rem"},children:["Played: ",format(new Date(a.last_play),"MM/d/yy hh:mmaa")]})]},a._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(d.ArticlesButton,{small:!0,onClick:()=>{n(!0)},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-cog me-0"})})]})]})})}module.exports=f;
1
+ "use strict";const e=require("./jsx-runtime-nZSsnGb7.cjs"),c=require("react"),l=require("./Modal-BNCxuVnD.cjs"),x=require("./Button-BVYvDTtH.cjs"),m=require("./index-CqsCVLvJ.cjs");function h({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 f=async s=>{if(process.env.NODE_ENV==="development")try{return(await m.axios.get("http://localhost:3001/api/community/games/scoreboard",{params:{game:s.game}})).data}catch{}return m.axios.get(s.url,{params:{game:s.game}}).then(t=>t.data)},E={dedupingInterval:1e3*60*30,refreshInterval:0,revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1},R=s=>{const{data:t,error:a,isLoading:n,isValidating:i,mutate:o}=m.useSWR(s?.game?{url:"https://articles.media/api/community/games/scoreboard",game:s.game}:null,f,E);return{data:t,error:a,isLoading:n,isValidating:i,mutate:o}};function b({game:s,reloadScoreboard:t,setReloadScoreboard:a}){const[n,i]=c.useState(!1),[o,j]=c.useState(!1),{data:d,mutate:u}=R({game:s});return c.useEffect(()=>{},[]),c.useEffect(()=>{t&&(a(!1),u())},[t]),e.jsxRuntimeExports.jsxs("div",{className:"scoreboard",children:[e.jsxRuntimeExports.jsxs(l.Modal,{show:n,size:"md",className:"articles-modal",centered:!0,onHide:()=>i(!1),children:[e.jsxRuntimeExports.jsx(l.Modal.Header,{children:e.jsxRuntimeExports.jsx(l.Modal.Title,{children:"Scoreboard Settings"})}),e.jsxRuntimeExports.jsx(l.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-between align-items-center",onClick:()=>j(!o),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(h,{checked:o})]})}),e.jsxRuntimeExports.jsx(l.Modal.Footer,{className:"justify-content-between",children:e.jsxRuntimeExports.jsx(x.ArticlesButton,{variant:"articles",onClick:()=>{i(!1)},children:"Close"})})]}),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(x.ArticlesButton,{onClick:()=>{u()},small:!0,children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-redo me-0"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"card-body p-0",children:[(d?.length||0)==0&&e.jsxRuntimeExports.jsx("div",{className:"small p-2",children:"No scores yet"}),d?.map((r,p)=>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:p+1}),e.jsxRuntimeExports.jsx("div",{className:"lh-sm"})]}),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(x.ArticlesButton,{small:!0,onClick:()=>{i(!0)},children:e.jsxRuntimeExports.jsx("i",{className:"fad fa-cog me-0"})})]})]})]})}module.exports=b;