@articles-media/articles-dev-box 1.0.3 → 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/README.md CHANGED
@@ -35,3 +35,8 @@ npm link @articles-media/articles-dev-box
35
35
  ⏹️ Remove Bootstrap reliance
36
36
  ⏹️ Look into npm package yalc
37
37
  ⏹️ Automatic GitHub Action for NPM
38
+
39
+
40
+ # TODO
41
+ - Bundle SCSS on a component level instead of a project level.
42
+ - Verify I am exporting components the most efficient way.
package/dist/Ad.cjs ADDED
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,469 @@
1
+ import { j as s } from "./jsx-runtime-tc70JA_2.js";
2
+ import * as w from "react";
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
+ return e ? (k.has(e) || (P += 1, k.set(e, P.toString())), k.get(e)) : "0";
9
+ }
10
+ function Q(e) {
11
+ return Object.keys(e).sort().filter(
12
+ (t) => e[t] !== void 0
13
+ ).map((t) => `${t}_${t === "root" ? J(e.root) : e[t]}`).toString();
14
+ }
15
+ function Y(e) {
16
+ const t = Q(e);
17
+ let a = $.get(t);
18
+ if (!a) {
19
+ const o = /* @__PURE__ */ new Map();
20
+ let l;
21
+ const n = new IntersectionObserver((c) => {
22
+ c.forEach((i) => {
23
+ var u;
24
+ const N = i.isIntersecting && l.some((v) => i.intersectionRatio >= v);
25
+ e.trackVisibility && typeof i.isVisible > "u" && (i.isVisible = N), (u = o.get(i.target)) == null || u.forEach((v) => {
26
+ v(N, i);
27
+ });
28
+ });
29
+ }, e);
30
+ l = n.thresholds || (Array.isArray(e.threshold) ? e.threshold : [e.threshold || 0]), a = {
31
+ id: t,
32
+ observer: n,
33
+ elements: o
34
+ }, $.set(t, a);
35
+ }
36
+ return a;
37
+ }
38
+ function Z(e, t, a = {}, o = H) {
39
+ if (typeof window.IntersectionObserver > "u" && o !== void 0) {
40
+ const u = e.getBoundingClientRect();
41
+ return t(o, {
42
+ isIntersecting: o,
43
+ target: e,
44
+ intersectionRatio: typeof a.threshold == "number" ? a.threshold : 0,
45
+ time: 0,
46
+ boundingClientRect: u,
47
+ intersectionRect: u,
48
+ rootBounds: u
49
+ }), () => {
50
+ };
51
+ }
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
+ };
56
+ }
57
+ function ee({
58
+ threshold: e,
59
+ delay: t,
60
+ trackVisibility: a,
61
+ rootMargin: o,
62
+ root: l,
63
+ triggerOnce: n,
64
+ skip: c,
65
+ initialInView: i,
66
+ fallbackInView: u,
67
+ onChange: N
68
+ } = {}) {
69
+ var v;
70
+ const [_, x] = w.useState(null), y = w.useRef(N), d = w.useRef(i), [g, E] = w.useState({
71
+ inView: !!i,
72
+ entry: void 0
73
+ });
74
+ y.current = N, w.useEffect(
75
+ () => {
76
+ if (d.current === void 0 && (d.current = i), c || !_) return;
77
+ let j;
78
+ return j = Z(
79
+ _,
80
+ (I, b) => {
81
+ const C = d.current;
82
+ d.current = I, !(C === void 0 && !I) && (E({
83
+ inView: I,
84
+ entry: b
85
+ }), y.current && y.current(I, b), b.isIntersecting && n && j && (j(), j = void 0));
86
+ },
87
+ {
88
+ root: l,
89
+ rootMargin: o,
90
+ threshold: e,
91
+ // @ts-expect-error
92
+ trackVisibility: a,
93
+ delay: t
94
+ },
95
+ u
96
+ ), () => {
97
+ j && j();
98
+ };
99
+ },
100
+ // We break the rule here, because we aren't including the actual `threshold` variable
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps
102
+ [
103
+ // If the threshold is an array, convert it to a string, so it won't change between renders.
104
+ Array.isArray(e) ? e.toString() : e,
105
+ _,
106
+ l,
107
+ o,
108
+ n,
109
+ c,
110
+ a,
111
+ u,
112
+ t
113
+ ]
114
+ );
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
+ inView: !!i,
118
+ entry: void 0
119
+ }), d.current = i);
120
+ const h = [x, g.inView, g.entry];
121
+ return h.ref = h[0], h.inView = h[1], h.entry = h[2], h;
122
+ }
123
+ const se = async (e) => {
124
+ if (process.env.NODE_ENV === "development")
125
+ try {
126
+ return (await M.get(`http://localhost:3001/api/ads/${e.ad_id}`, {
127
+ params: {
128
+ ad_id: e.ad_id
129
+ }
130
+ })).data.result;
131
+ } catch {
132
+ }
133
+ return M.get(e.url, {
134
+ params: {
135
+ ad_id: e.ad_id
136
+ }
137
+ }).then((t) => t.data.result);
138
+ }, te = 60, re = {
139
+ dedupingInterval: 1e3 * 60 * te
140
+ // keepPreviousData: true,
141
+ // fallbackData: []
142
+ }, ne = (e) => {
143
+ const { data: t, error: a, isLoading: o, mutate: l } = W(
144
+ e ? {
145
+ url: `https://articles.media/api/ads/${e}`,
146
+ ad_id: e
147
+ } : null,
148
+ se,
149
+ re
150
+ );
151
+ return {
152
+ data: t,
153
+ error: a,
154
+ isLoading: o,
155
+ mutate: l
156
+ };
157
+ }, X = 6e4, T = /* @__PURE__ */ Symbol.for("constructDateFrom");
158
+ function oe(e, t) {
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
+ }
161
+ function L(e, t) {
162
+ return oe(e, e);
163
+ }
164
+ function ae(e) {
165
+ return (t) => {
166
+ const o = (e ? Math[e] : Math.trunc)(t);
167
+ return o === 0 ? 0 : o;
168
+ };
169
+ }
170
+ function ie(e, t) {
171
+ return +L(e) - +L(t);
172
+ }
173
+ function O(e, t, a) {
174
+ const o = ie(e, t) / X;
175
+ return ae(a?.roundingMethod)(o);
176
+ }
177
+ function B(e) {
178
+ return Math.trunc(e * X);
179
+ }
180
+ const ce = async (e) => {
181
+ if (process.env.NODE_ENV === "development")
182
+ try {
183
+ return (await M.get("http://localhost:3001/api/ads", {
184
+ params: {
185
+ // ad_id: data.ad_id
186
+ }
187
+ })).data;
188
+ } catch {
189
+ }
190
+ return M.get(e.url, {
191
+ params: {
192
+ // ad_id: data.ad_id
193
+ }
194
+ }).then((t) => t.data);
195
+ }, U = 60, le = {
196
+ dedupingInterval: B(U),
197
+ focusThrottleInterval: B(U)
198
+ // keepPreviousData: true,
199
+ // fallbackData: []
200
+ }, de = (e) => {
201
+ const { data: t, error: a, isLoading: o, mutate: l } = W(
202
+ {
203
+ url: "https://articles.media/api/ads"
204
+ // ad_id
205
+ },
206
+ ce,
207
+ le
208
+ );
209
+ return {
210
+ data: t,
211
+ error: a,
212
+ isLoading: o,
213
+ mutate: l
214
+ };
215
+ }, ue = q(() => import("./AdDetailsModal-BOLzA3ZL.js"));
216
+ function fe(e, t) {
217
+ return Math.floor(Math.random() * (t - e + 1)) + e;
218
+ }
219
+ function me(e) {
220
+ const a = [], {
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
+ r?.populated_promos && d >= 0 && y(r?.populated_promos[d]);
230
+ }, [d, r]);
231
+ function F() {
232
+ h(!A);
233
+ }
234
+ const { ref: z, inView: S } = ee({
235
+ /* Optional options */
236
+ threshold: 0,
237
+ triggerOnce: !0
238
+ });
239
+ function V(f) {
240
+ if (l && console.log("Preventing this event from being logged as this ad is being shown in preview mode."), b.find((m) => m == f)) {
241
+ console.log("Already logged this event");
242
+ return;
243
+ }
244
+ M.get("/api/ads/event", {
245
+ params: {
246
+ ad_id: r?._id,
247
+ event: f
248
+ }
249
+ }).then(function(m) {
250
+ C([...b, f]), console.log(m.data);
251
+ }).catch(function(m) {
252
+ console.log(m);
253
+ });
254
+ }
255
+ return R(() => {
256
+ if (!l && (console.log("inView", S), S && c)) {
257
+ let f = [
258
+ {
259
+ ad_id: c,
260
+ date: (/* @__PURE__ */ new Date()).toString()
261
+ },
262
+ ...a.filter((m) => {
263
+ if (console.log(
264
+ O(/* @__PURE__ */ new Date(), new Date(m.date))
265
+ ), O(/* @__PURE__ */ new Date(), new Date(m.date)) > 5) {
266
+ console.log("adsViewed - Remove Old Ad View Object");
267
+ return;
268
+ } else
269
+ return console.log("adsViewed - Keep Ad View Object"), m;
270
+ })
271
+ ];
272
+ console.log("unexpiredRecentViews", f);
273
+ }
274
+ }, [S, c]), /* @__PURE__ */ s.jsxs(
275
+ "div",
276
+ {
277
+ ref: z,
278
+ className: "ad-wrap",
279
+ style: {
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
+ },
284
+ children: [
285
+ A && /* @__PURE__ */ s.jsx(
286
+ ue,
287
+ {
288
+ setModalShow: h,
289
+ ad: r,
290
+ previewData: n
291
+ }
292
+ ),
293
+ /* @__PURE__ */ s.jsx(
294
+ "div",
295
+ {
296
+ className: "ad",
297
+ children: /* @__PURE__ */ s.jsxs(
298
+ "div",
299
+ {
300
+ className: "main-panel",
301
+ children: [
302
+ /* @__PURE__ */ s.jsx("div", { className: "ad-warning flex-header", children: /* @__PURE__ */ s.jsxs("div", { className: "", children: [
303
+ r?.city && "Local",
304
+ " Advertisement"
305
+ ] }) }),
306
+ /* @__PURE__ */ s.jsxs("div", { className: "content-wrap", children: [
307
+ /* @__PURE__ */ s.jsxs("div", { className: "photo-banner", children: [
308
+ /* @__PURE__ */ s.jsx("div", { className: "logo", children: (n.logo?.location || r?.logo?.location) && /* @__PURE__ */ s.jsx(
309
+ "img",
310
+ {
311
+ src: n?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${n?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.logo?.key}`,
312
+ alt: ""
313
+ }
314
+ ) }),
315
+ /* @__PURE__ */ s.jsx("div", { className: "icon d-none", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-mug-hot" }) }),
316
+ /* @__PURE__ */ s.jsx(
317
+ "img",
318
+ {
319
+ className: "photo",
320
+ src: n?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${n.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${r?.background?.key}`,
321
+ alt: ""
322
+ }
323
+ )
324
+ ] }),
325
+ /* @__PURE__ */ s.jsxs("div", { className: "details-wrap", children: [
326
+ /* @__PURE__ */ s.jsxs("div", { className: "detail-title", children: [
327
+ /* @__PURE__ */ s.jsx("div", { className: "detail", children: /* @__PURE__ */ s.jsx("span", { className: "h4", children: n?.business || r?.business }) }),
328
+ /* @__PURE__ */ s.jsxs("div", { className: "flex flex-column d-none", children: [
329
+ /* @__PURE__ */ s.jsxs("div", { className: "detail", children: [
330
+ /* @__PURE__ */ s.jsx("span", { className: "icon", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-search-location" }) }),
331
+ /* @__PURE__ */ s.jsxs("span", { children: [
332
+ r?.city,
333
+ ", ",
334
+ r?.state
335
+ ] })
336
+ ] }),
337
+ /* @__PURE__ */ s.jsxs("div", { className: "detail", children: [
338
+ /* @__PURE__ */ s.jsx("span", { className: "icon", children: /* @__PURE__ */ s.jsx("i", { className: "fas fa-clock me-2" }) }),
339
+ /* @__PURE__ */ s.jsx("span", { children: "6:30AM–8PM" })
340
+ ] })
341
+ ] })
342
+ ] }),
343
+ r?.city && /* @__PURE__ */ s.jsx("div", { className: "details mb-3 d-none" }),
344
+ /* @__PURE__ */ s.jsx("div", { className: "short-description", children: n?.description || r?.description })
345
+ ] })
346
+ ] }),
347
+ (!1)?.roles?.isDev && r?.populated_promos?.length > 0 && /* @__PURE__ */ s.jsxs("div", { children: [
348
+ x && /* @__PURE__ */ s.jsx("div", { className: "promos-wrap", children: x && /* @__PURE__ */ s.jsxs(
349
+ "div",
350
+ {
351
+ className: "promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",
352
+ children: [
353
+ /* @__PURE__ */ s.jsxs("div", { className: "", children: [
354
+ /* @__PURE__ */ s.jsx("div", { children: x.title }),
355
+ /* @__PURE__ */ s.jsx("div", { className: "small", children: /* @__PURE__ */ s.jsx("div", { className: "small", children: x.details }) })
356
+ ] }),
357
+ /* @__PURE__ */ s.jsx(
358
+ G,
359
+ {
360
+ className: "px-3",
361
+ small: !0,
362
+ onClick: () => {
363
+ console.log("Load Save Modal"), D(!0);
364
+ },
365
+ children: "Save"
366
+ }
367
+ )
368
+ ]
369
+ },
370
+ x._id
371
+ ) }),
372
+ /* @__PURE__ */ s.jsxs("div", { className: "d-flex justify-content-between", children: [
373
+ /* @__PURE__ */ s.jsxs("div", { className: "px-2", children: [
374
+ r?.populated_promos?.length,
375
+ " Promos Active"
376
+ ] }),
377
+ /* @__PURE__ */ s.jsxs("div", { className: "controls", children: [
378
+ /* @__PURE__ */ s.jsx(
379
+ "i",
380
+ {
381
+ className: "fad fa-arrow-circle-left",
382
+ type: "button",
383
+ onClick: () => {
384
+ d == 0 ? g(r?.populated_promos?.length - 1) : g((f) => f - 1);
385
+ }
386
+ }
387
+ ),
388
+ r?.populated_promos?.map(
389
+ (f, m) => /* @__PURE__ */ s.jsx(
390
+ "i",
391
+ {
392
+ className: `fa-square ${m == d ? "fad" : "fas"}`
393
+ },
394
+ f._id
395
+ )
396
+ ),
397
+ /* @__PURE__ */ s.jsx(
398
+ "i",
399
+ {
400
+ className: "fad fa-arrow-circle-right",
401
+ type: "button",
402
+ onClick: () => {
403
+ d == r?.populated_promos?.length - 1 ? g(0) : g((f) => f + 1);
404
+ }
405
+ }
406
+ )
407
+ ] })
408
+ ] })
409
+ ] }),
410
+ /* @__PURE__ */ s.jsx("hr", { style: { borderColor: "white" }, className: "mt-auto mb-0" }),
411
+ /* @__PURE__ */ s.jsxs("div", { className: "action-wrap d-flex justify-content-lg-between px-3 py-2", children: [
412
+ /* @__PURE__ */ s.jsx(
413
+ "div",
414
+ {
415
+ onClick: () => {
416
+ F(), V("Details");
417
+ },
418
+ className: "action flex-grow-1 flex-shrink-0",
419
+ children: "Details"
420
+ }
421
+ ),
422
+ /* @__PURE__ */ s.jsx("span", { className: "px-4" }),
423
+ /* @__PURE__ */ s.jsx(
424
+ "a",
425
+ {
426
+ className: "action flex-grow-1 flex-shrink-0",
427
+ href: r?.website,
428
+ target: "_blank",
429
+ rel: "noreferrer",
430
+ onClick: () => V("Website"),
431
+ children: /* @__PURE__ */ s.jsx("div", { children: "Website" })
432
+ }
433
+ )
434
+ ] })
435
+ ]
436
+ }
437
+ )
438
+ }
439
+ ),
440
+ !l && /* @__PURE__ */ s.jsx(
441
+ "div",
442
+ {
443
+ className: "advertise-with-us p-1",
444
+ style: {
445
+ // ...(props.previewData ? props.previewData.background_color : ad?.background_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
449
+ },
450
+ children: /* @__PURE__ */ s.jsxs(
451
+ "div",
452
+ {
453
+ className: "small d-block w-100 text-center",
454
+ children: [
455
+ /* @__PURE__ */ s.jsx("i", { className: "fas fa-share me-1" }),
456
+ "Advertise with Articles Media!"
457
+ ]
458
+ }
459
+ )
460
+ }
461
+ )
462
+ ]
463
+ }
464
+ );
465
+ }
466
+ const xe = K(me);
467
+ export {
468
+ xe as default
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,16 @@
1
+ import { j as t } from "./jsx-runtime-tc70JA_2.js";
2
+ import { useEffect as s } from "react";
3
+ function a({
4
+ darkMode: r
5
+ }) {
6
+ return s(() => {
7
+ }, []), s(() => {
8
+ const e = document.createElement("script");
9
+ return e.src = "https://accounts.articles.media/js/ad.js", e.async = !0, document.body.appendChild(e), () => {
10
+ document.body.removeChild(e);
11
+ };
12
+ }, []), /* @__PURE__ */ t.jsx("div", { className: "", children: /* @__PURE__ */ t.jsx("div", { className: "articles-media-ad" }) });
13
+ }
14
+ export {
15
+ a as default
16
+ };