@articles-media/articles-dev-box 1.0.22 → 1.0.24

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.
Files changed (66) hide show
  1. package/dist/Ad-BAvmOFcq.js +503 -0
  2. package/dist/Ad.js +1 -1
  3. package/dist/AdConfirmExitModal-BNFKKayL.js +55 -0
  4. package/dist/AdDetailsModal-Cv1ll9G-.js +107 -0
  5. package/dist/ArticlesAd.js +7 -8
  6. package/dist/{Button-BlAdEbSd.js → Button-CU11ETla.js} +9 -9
  7. package/dist/CreditsModal.js +23 -24
  8. package/dist/DarkModeHandler.js +11 -12
  9. package/dist/FriendsList.js +40 -41
  10. package/dist/{GameScoreboard-CBY3JsFa.js → GameScoreboard-Dj5mTFTn.js} +48 -49
  11. package/dist/GameScoreboard.js +1 -1
  12. package/dist/GlobalBody.js +20 -20
  13. package/dist/GlobalHead.js +2 -3
  14. package/dist/Link-8nSDV4sI.js +16 -0
  15. package/dist/ReturnToLauncherButton.js +17 -18
  16. package/dist/SettingsModal-tXcbd23J.js +246 -0
  17. package/dist/SettingsModal.js +1 -1
  18. package/dist/StatusModal-CBzdZdAm.js +69 -0
  19. package/dist/ViewUserModal-C_gWUvXi.js +1544 -0
  20. package/dist/ViewUserModal.js +1 -1
  21. package/dist/{classnames-DP6dWde5.js → classnames-CpG5mzJ5.js} +12 -4
  22. package/dist/index.js +4 -4
  23. package/dist/numberWithCommas-rN3cZDJL.js +1170 -0
  24. package/package.json +18 -66
  25. package/dist/Ad-Ck5UdTq3.js +0 -387
  26. package/dist/Ad-DYtftKNV.cjs +0 -1
  27. package/dist/Ad.cjs +0 -1
  28. package/dist/AdConfirmExitModal-CJ-HtcVC.js +0 -56
  29. package/dist/AdConfirmExitModal-CRCnzYQM.cjs +0 -1
  30. package/dist/AdDetailsModal-DRNRTL2W.js +0 -108
  31. package/dist/AdDetailsModal-g0n7LiV6.cjs +0 -1
  32. package/dist/ArticlesAd.cjs +0 -1
  33. package/dist/Button-CbpRj01E.cjs +0 -1
  34. package/dist/CreditsModal.cjs +0 -1
  35. package/dist/DarkModeHandler.cjs +0 -1
  36. package/dist/FriendsList.cjs +0 -1
  37. package/dist/GameScoreboard-DdOCRxON.cjs +0 -1
  38. package/dist/GameScoreboard.cjs +0 -1
  39. package/dist/GlobalBody.cjs +0 -33
  40. package/dist/GlobalHead.cjs +0 -1
  41. package/dist/Link-MFZblBb4.js +0 -17
  42. package/dist/Link-c7exNCJ3.cjs +0 -1
  43. package/dist/Modal-BX1s6CCU.js +0 -1631
  44. package/dist/Modal-DP9CeAVD.cjs +0 -3
  45. package/dist/ReturnToLauncherButton.cjs +0 -1
  46. package/dist/SettingsModal--sWLmLGp.cjs +0 -1
  47. package/dist/SettingsModal-XI2dMI09.js +0 -247
  48. package/dist/SettingsModal.cjs +0 -1
  49. package/dist/StatusModal-D7WDDR9P.cjs +0 -1
  50. package/dist/StatusModal-elrPJvX1.js +0 -70
  51. package/dist/ViewUserModal-DDjWLpyM.js +0 -3094
  52. package/dist/ViewUserModal-DPVcjXNU.cjs +0 -1
  53. package/dist/ViewUserModal.cjs +0 -1
  54. package/dist/chunk-350yNsax.cjs +0 -1
  55. package/dist/classnames-pS64X3rL.cjs +0 -1
  56. package/dist/index.cjs +0 -1
  57. package/dist/jsx-runtime-VZk6y-ec.js +0 -191
  58. package/dist/jsx-runtime-hCcDh67y.cjs +0 -6
  59. package/dist/numberWithCommas-BSKBdR-e.js +0 -18
  60. package/dist/numberWithCommas-D9tgiUnq.cjs +0 -1
  61. package/dist/useAuthSiteStatus-P5kHc_Bz.cjs +0 -1
  62. package/dist/useFullscreen.cjs +0 -1
  63. package/dist/useUserDetails.cjs +0 -1
  64. package/dist/useUserFriends.cjs +0 -1
  65. package/dist/useUserToken.cjs +0 -1
  66. /package/dist/{useAuthSiteStatus-1rHjYC4N.js → useAuthSiteStatus-Cj9IjMj7.js} +0 -0
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@articles-media/articles-dev-box",
3
3
  "description": "Shared code, functions, and components for different Articles Media projects.",
4
- "version": "1.0.22",
4
+ "version": "1.0.24",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"
8
8
  },
9
- "main": "./dist/index.cjs",
9
+ "main": "./dist/index.js",
10
10
  "module": "./dist/index.js",
11
11
  "files": [
12
12
  "dist"
@@ -16,70 +16,22 @@
16
16
  "url": "git+https://github.com/Articles-Joey/articles-dev-box.git"
17
17
  },
18
18
  "exports": {
19
- ".": {
20
- "import": "./dist/index.js",
21
- "require": "./dist/index.cjs"
22
- },
23
- "./Ad": {
24
- "import": "./dist/Ad.js",
25
- "require": "./dist/Ad.cjs"
26
- },
27
- "./ArticlesAd": {
28
- "import": "./dist/ArticlesAd.js",
29
- "require": "./dist/ArticlesAd.cjs"
30
- },
31
- "./GameScoreboard": {
32
- "import": "./dist/GameScoreboard.js",
33
- "require": "./dist/GameScoreboard.cjs"
34
- },
35
- "./ReturnToLauncherButton": {
36
- "import": "./dist/ReturnToLauncherButton.js",
37
- "require": "./dist/ReturnToLauncherButton.cjs"
38
- },
39
- "./GlobalHead": {
40
- "import": "./dist/GlobalHead.js",
41
- "require": "./dist/GlobalHead.cjs"
42
- },
43
- "./GlobalBody": {
44
- "import": "./dist/GlobalBody.js",
45
- "require": "./dist/GlobalBody.cjs"
46
- },
47
- "./ViewUserModal": {
48
- "import": "./dist/ViewUserModal.js",
49
- "require": "./dist/ViewUserModal.cjs"
50
- },
51
- "./SettingsModal": {
52
- "import": "./dist/SettingsModal.js",
53
- "require": "./dist/SettingsModal.cjs"
54
- },
55
- "./CreditsModal": {
56
- "import": "./dist/CreditsModal.js",
57
- "require": "./dist/CreditsModal.cjs"
58
- },
59
- "./DarkModeHandler": {
60
- "import": "./dist/DarkModeHandler.js",
61
- "require": "./dist/DarkModeHandler.cjs"
62
- },
63
- "./FriendsList": {
64
- "import": "./dist/FriendsList.js",
65
- "require": "./dist/FriendsList.cjs"
66
- },
67
- "./useUserDetails": {
68
- "import": "./dist/useUserDetails.js",
69
- "require": "./dist/useUserDetails.cjs"
70
- },
71
- "./useUserToken": {
72
- "import": "./dist/useUserToken.js",
73
- "require": "./dist/useUserToken.cjs"
74
- },
75
- "./useUserFriends": {
76
- "import": "./dist/useUserFriends.js",
77
- "require": "./dist/useUserFriends.cjs"
78
- },
79
- "./useFullscreen": {
80
- "import": "./dist/useFullscreen.js",
81
- "require": "./dist/useFullscreen.cjs"
82
- },
19
+ ".": "./dist/index.js",
20
+ "./Ad": "./dist/Ad.js",
21
+ "./ArticlesAd": "./dist/ArticlesAd.js",
22
+ "./GameScoreboard": "./dist/GameScoreboard.js",
23
+ "./ReturnToLauncherButton": "./dist/ReturnToLauncherButton.js",
24
+ "./GlobalHead": "./dist/GlobalHead.js",
25
+ "./GlobalBody": "./dist/GlobalBody.js",
26
+ "./ViewUserModal": "./dist/ViewUserModal.js",
27
+ "./SettingsModal": "./dist/SettingsModal.js",
28
+ "./CreditsModal": "./dist/CreditsModal.js",
29
+ "./DarkModeHandler": "./dist/DarkModeHandler.js",
30
+ "./FriendsList": "./dist/FriendsList.js",
31
+ "./useUserDetails": "./dist/useUserDetails.js",
32
+ "./useUserToken": "./dist/useUserToken.js",
33
+ "./useUserFriends": "./dist/useUserFriends.js",
34
+ "./useFullscreen": "./dist/useFullscreen.js",
83
35
  "./dist/style.css": "./dist/articles-dev-box.css",
84
36
  "./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
85
37
  },
@@ -1,387 +0,0 @@
1
- import { r as e, t } from "./jsx-runtime-VZk6y-ec.js";
2
- import { t as n } from "./classnames-DP6dWde5.js";
3
- import { t as r } from "./Button-BlAdEbSd.js";
4
- import { t as i } from "./Link-MFZblBb4.js";
5
- import { n as a, t as o } from "./numberWithCommas-BSKBdR-e.js";
6
- import { lazy as s, memo as c, useEffect as l, useState as u } from "react";
7
- import { useInView as d } from "react-intersection-observer";
8
- import f from "swr";
9
- import { differenceInMinutes as p, minutesToMilliseconds as m } from "date-fns";
10
- //#region src/hooks/Ads/useAd.js
11
- var h = async (e) => {
12
- if (process.env.NODE_ENV === "development") try {
13
- let t = new URLSearchParams({
14
- ad_id: e.ad_id,
15
- user_ad_token: e.user_ad_token
16
- }).toString();
17
- return (await (await fetch(`http://localhost:3001/api/ads/${e.ad_id}?${t}`)).json()).result;
18
- } catch {}
19
- let t = new URLSearchParams({ ad_id: e.ad_id }).toString();
20
- return fetch(`${e.url}?${t}`).then((e) => e.json()).then((e) => e.result);
21
- }, g = { dedupingInterval: 1e3 * 60 * 60 }, _ = (e, t) => {
22
- let { data: n, error: r, isLoading: i, mutate: a } = f(e ? {
23
- url: `https://articles.media/api/ads/${e}`,
24
- ad_id: e,
25
- user_ad_token: t
26
- } : null, h, g);
27
- return {
28
- data: n,
29
- error: r,
30
- isLoading: i,
31
- mutate: a
32
- };
33
- }, v = async (e) => {
34
- if (process.env.NODE_ENV === "development") try {
35
- return await (await fetch("http://localhost:3001/api/ads")).json();
36
- } catch {}
37
- return fetch(e.url).then((e) => e.json());
38
- }, y = 60, b = {
39
- dedupingInterval: m(y),
40
- focusThrottleInterval: m(y)
41
- }, x = (e) => {
42
- let { data: t, error: n, isLoading: r, mutate: i } = f(e?.loading || e?.disabled ? null : { url: "https://articles.media/api/ads" }, v, b);
43
- return {
44
- data: t,
45
- error: n,
46
- isLoading: r,
47
- mutate: i
48
- };
49
- }, S = t(), C = /* @__PURE__ */ e(n(), 1), w = s(() => import("./AdDetailsModal-DRNRTL2W.js")), T = s(() => import("./AdConfirmExitModal-CJ-HtcVC.js"));
50
- function E(e, t) {
51
- return Math.floor(Math.random() * (t - e + 1)) + e;
52
- }
53
- function D(e) {
54
- let { previewMode: t, darkMode: n, user_ad_token: s, userDetails: c, userDetailsLoading: f, prepend: m, append: h } = e, g = [], [v, y] = u(null), { data: b, isLoading: D, mutate: O } = x({
55
- loading: f,
56
- disabled: c?.articles_membership?.status == "Active"
57
- }), { data: k, isLoading: ee } = _(v, s), A = e.previewData || {}, [te, ne] = u(null), [j, M] = u(null), [N, P] = u(null), [F, I] = u(0), [L, R] = u(!1), [z, B] = u(!1), [V, H] = u(!1), [re, ie] = u(/* @__PURE__ */ new Date()), [U, W] = u([]);
58
- l(() => {
59
- b && b?.length > 0 && !v && (console.log("Ad Mounted or reduxAds changed"), y(e.ad_id || b[E(0, b?.length - 1)]?._id));
60
- }, [b]), l(() => {}, [k]), l(() => {
61
- k?.populated_promos && F >= 0 && P(k?.populated_promos[F]);
62
- }, [F, k]);
63
- function G() {
64
- B(!z);
65
- }
66
- let { ref: K, inView: q, entry: ae } = d({
67
- threshold: 0,
68
- triggerOnce: !0
69
- });
70
- function J(e) {
71
- if (t && console.log("Preventing this event from being logged as this ad is being shown in preview mode."), U.find((t) => t == e)) {
72
- console.log("Already logged this event");
73
- return;
74
- }
75
- let n = new URLSearchParams({
76
- ad_id: k?._id,
77
- event: e
78
- }).toString();
79
- fetch(`/api/ads/event?${n}`).then(function(e) {
80
- return e.json();
81
- }).then(function(t) {
82
- W([...U, e]), console.log(t);
83
- }).catch(function(e) {
84
- console.log(e);
85
- });
86
- }
87
- l(() => {
88
- if (!t && (console.log("inView", q), q && v)) {
89
- let e = [{
90
- ad_id: v,
91
- date: (/* @__PURE__ */ new Date()).toString()
92
- }, ...g.filter((e) => {
93
- if (console.log(p(/* @__PURE__ */ new Date(), new Date(e.date))), p(/* @__PURE__ */ new Date(), new Date(e.date)) > 5) {
94
- console.log("adsViewed - Remove Old Ad View Object");
95
- return;
96
- } else return console.log("adsViewed - Keep Ad View Object"), e;
97
- })];
98
- console.log("unexpiredRecentViews", e);
99
- }
100
- }, [q, v]);
101
- let [Y, X] = u(null), [Z, Q] = u(!1);
102
- function $() {
103
- Q(!0), console.log("logAdAvoided called", s);
104
- let e = process.env.NODE_ENV === "development" ? "http://localhost:3001/api/user/advertising/avoided" : "https://articles.media/api/user/advertising/avoided", t = new URLSearchParams({ user_id: c?._id }).toString();
105
- fetch(`${e}?${t}`, { headers: { "x-articles-api-key": s } }).then(function(e) {
106
- return e.json();
107
- }).then(function(e) {
108
- Q(!1), X(e.avoided_count), console.log(e);
109
- }).catch(function(e) {
110
- console.log(e), Q(!1);
111
- });
112
- }
113
- return l(() => {
114
- t || (console.log("inView", q), c?.articles_membership?.status == "Active" && q && $("Ad Avoided"));
115
- }, [q, c]), f ? null : /* @__PURE__ */ (0, S.jsxs)("div", {
116
- ref: K,
117
- className: (0, C.default)("ad-wrap", { "active-member": c?.articles_membership?.status == "Active" }),
118
- style: {
119
- "--articles-ad-background-color": A.background_color || k?.background_color,
120
- "--articles-ad-font-color": A.font_color || k?.font_color,
121
- "--articles-ad-border-color": A.border_color || k?.border_color
122
- },
123
- children: [
124
- z && /* @__PURE__ */ (0, S.jsx)(w, {
125
- setModalShow: B,
126
- ad: k,
127
- previewData: A
128
- }),
129
- V && /* @__PURE__ */ (0, S.jsx)(T, {
130
- setModalShow: H,
131
- ad: k,
132
- previewData: A
133
- }),
134
- m && /* @__PURE__ */ (0, S.jsx)("div", {
135
- className: "prepend-container",
136
- children: m
137
- }),
138
- /* @__PURE__ */ (0, S.jsxs)("div", {
139
- className: "ad",
140
- children: [c?.articles_membership?.status !== "Active" && /* @__PURE__ */ (0, S.jsxs)("div", {
141
- className: "main-panel",
142
- children: [
143
- /* @__PURE__ */ (0, S.jsx)("div", {
144
- className: "ad-warning flex-header",
145
- children: /* @__PURE__ */ (0, S.jsxs)("div", {
146
- className: "",
147
- children: [k?.city && "Local", " Advertisement"]
148
- })
149
- }),
150
- /* @__PURE__ */ (0, S.jsxs)("div", {
151
- className: "content-wrap",
152
- children: [/* @__PURE__ */ (0, S.jsxs)("div", {
153
- className: "photo-banner",
154
- children: [
155
- /* @__PURE__ */ (0, S.jsx)("div", {
156
- className: "logo",
157
- children: (A.logo?.location || k?.logo?.location) && /* @__PURE__ */ (0, S.jsx)("img", {
158
- src: A?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${A?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${k?.logo?.key}`,
159
- alt: ""
160
- })
161
- }),
162
- /* @__PURE__ */ (0, S.jsx)("div", {
163
- className: "icon d-none",
164
- children: /* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-mug-hot" })
165
- }),
166
- /* @__PURE__ */ (0, S.jsx)("img", {
167
- className: "photo",
168
- src: A?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${A.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${k?.background?.key}`,
169
- alt: ""
170
- })
171
- ]
172
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
173
- className: "details-wrap",
174
- children: [
175
- /* @__PURE__ */ (0, S.jsxs)("div", {
176
- className: "detail-title",
177
- children: [/* @__PURE__ */ (0, S.jsx)("div", {
178
- className: "detail",
179
- children: /* @__PURE__ */ (0, S.jsx)("span", {
180
- className: "h4",
181
- children: A?.business || k?.business
182
- })
183
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
184
- className: "flex flex-column d-none",
185
- children: [/* @__PURE__ */ (0, S.jsxs)("div", {
186
- className: "detail",
187
- children: [/* @__PURE__ */ (0, S.jsx)("span", {
188
- className: "icon",
189
- children: /* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-search-location" })
190
- }), /* @__PURE__ */ (0, S.jsxs)("span", { children: [
191
- k?.city,
192
- ", ",
193
- k?.state
194
- ] })]
195
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
196
- className: "detail",
197
- children: [/* @__PURE__ */ (0, S.jsx)("span", {
198
- className: "icon",
199
- children: /* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-clock me-2" })
200
- }), /* @__PURE__ */ (0, S.jsx)("span", { children: "6:30AM–8PM" })]
201
- })]
202
- })]
203
- }),
204
- k?.city && /* @__PURE__ */ (0, S.jsx)("div", { className: "details mb-3 d-none" }),
205
- /* @__PURE__ */ (0, S.jsx)("div", {
206
- className: "short-description",
207
- children: A?.description || k?.description
208
- })
209
- ]
210
- })]
211
- }),
212
- (!1)?.roles?.isDev && k?.populated_promos?.length > 0 && /* @__PURE__ */ (0, S.jsxs)("div", { children: [N && /* @__PURE__ */ (0, S.jsx)("div", {
213
- className: "promos-wrap",
214
- children: N && /* @__PURE__ */ (0, S.jsxs)("div", {
215
- className: "promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",
216
- children: [/* @__PURE__ */ (0, S.jsxs)("div", {
217
- className: "",
218
- children: [/* @__PURE__ */ (0, S.jsx)("div", { children: N.title }), /* @__PURE__ */ (0, S.jsx)("div", {
219
- className: "small",
220
- children: /* @__PURE__ */ (0, S.jsx)("div", {
221
- className: "small",
222
- children: N.details
223
- })
224
- })]
225
- }), /* @__PURE__ */ (0, S.jsx)(r, {
226
- className: "px-3",
227
- small: !0,
228
- onClick: () => {
229
- console.log("Load Save Modal"), R(!0);
230
- },
231
- children: "Save"
232
- })]
233
- }, N._id)
234
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
235
- className: "d-flex justify-content-between",
236
- children: [/* @__PURE__ */ (0, S.jsxs)("div", {
237
- className: "px-2",
238
- children: [k?.populated_promos?.length, " Promos Active"]
239
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
240
- className: "controls",
241
- children: [
242
- /* @__PURE__ */ (0, S.jsx)("i", {
243
- className: "fad fa-arrow-circle-left",
244
- type: "button",
245
- onClick: () => {
246
- I(F == 0 ? k?.populated_promos?.length - 1 : (e) => e - 1);
247
- }
248
- }),
249
- k?.populated_promos?.map((e, t) => /* @__PURE__ */ (0, S.jsx)("i", { className: `fa-square ${t == F ? "fad" : "fas"}` }, e._id)),
250
- /* @__PURE__ */ (0, S.jsx)("i", {
251
- className: "fad fa-arrow-circle-right",
252
- type: "button",
253
- onClick: () => {
254
- F == k?.populated_promos?.length - 1 ? I(0) : I((e) => e + 1);
255
- }
256
- })
257
- ]
258
- })]
259
- })] }),
260
- /* @__PURE__ */ (0, S.jsx)("hr", {
261
- style: { borderColor: "white" },
262
- className: "mt-auto mb-0"
263
- }),
264
- /* @__PURE__ */ (0, S.jsxs)("div", {
265
- className: "action-wrap d-flex justify-content-lg-between px-3 py-2",
266
- children: [
267
- /* @__PURE__ */ (0, S.jsx)("div", {
268
- onClick: () => {
269
- G(), J("Details");
270
- },
271
- className: "action flex-grow-1 flex-shrink-0",
272
- children: "Details"
273
- }),
274
- /* @__PURE__ */ (0, S.jsx)("span", { className: "px-4" }),
275
- /* @__PURE__ */ (0, S.jsx)("a", {
276
- className: "action flex-grow-1 flex-shrink-0",
277
- href: k?.website,
278
- target: "_blank",
279
- rel: "noreferrer",
280
- onClick: (e) => {
281
- e.preventDefault(), H(!0), J("Confirm Exit Modal Opened");
282
- },
283
- children: /* @__PURE__ */ (0, S.jsx)("div", { children: "Website" })
284
- })
285
- ]
286
- })
287
- ]
288
- }), c?.articles_membership?.status == "Active" && /* @__PURE__ */ (0, S.jsx)("div", {
289
- className: "main-panel",
290
- children: /* @__PURE__ */ (0, S.jsxs)("div", {
291
- className: "content-wrap",
292
- children: [/* @__PURE__ */ (0, S.jsxs)("div", {
293
- className: "photo-banner",
294
- children: [
295
- /* @__PURE__ */ (0, S.jsx)("div", { className: "logo" }),
296
- /* @__PURE__ */ (0, S.jsxs)("div", {
297
- className: "splash",
298
- children: [/* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-broadcast-tower" }), /* @__PURE__ */ (0, S.jsxs)("div", {
299
- className: "text",
300
- children: [/* @__PURE__ */ (0, S.jsx)("div", {
301
- className: "count",
302
- children: Z ? /* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-spinner fa-spin me-0" }) : Y ? o(Y) : 0
303
- }), /* @__PURE__ */ (0, S.jsx)("div", {
304
- className: "label",
305
- children: "ads avoided."
306
- })]
307
- })]
308
- }),
309
- /* @__PURE__ */ (0, S.jsxs)("div", {
310
- className: "member-since",
311
- children: ["Member since: ", /* @__PURE__ */ (0, S.jsx)(a, {
312
- format: "PP",
313
- date: c?.articles_membership?.membership_started
314
- })]
315
- })
316
- ]
317
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
318
- className: "details-wrap",
319
- children: [/* @__PURE__ */ (0, S.jsx)("div", {
320
- className: "detail-title",
321
- children: /* @__PURE__ */ (0, S.jsx)("div", {
322
- className: "detail",
323
- children: /* @__PURE__ */ (0, S.jsx)("span", {
324
- className: "h4",
325
- children: "Thanks for the support!"
326
- })
327
- })
328
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
329
- className: "short-description",
330
- children: [/* @__PURE__ */ (0, S.jsx)("div", {
331
- className: "mb-2",
332
- children: "Without support from users like you, we wouldn't be here."
333
- }), /* @__PURE__ */ (0, S.jsxs)("div", {
334
- className: "links-list",
335
- children: [
336
- /* @__PURE__ */ (0, S.jsxs)(i, {
337
- newPage: !0,
338
- className: "link-item",
339
- href: "https://articles.media/messages",
340
- children: [/* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-comments-alt" }), "0 unread messages."]
341
- }),
342
- /* @__PURE__ */ (0, S.jsxs)(i, {
343
- newPage: !0,
344
- className: "link-item",
345
- href: "https://articles.media/settings/notifications",
346
- onClick: () => {
347
- $();
348
- },
349
- children: [/* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-bell" }), "0 notifications."]
350
- }),
351
- /* @__PURE__ */ (0, S.jsxs)(i, {
352
- newPage: !0,
353
- className: "link-item",
354
- href: "https://articles.media/settings/account",
355
- children: [/* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-cog" }), "Manage account settings."]
356
- })
357
- ]
358
- })]
359
- })]
360
- })]
361
- })
362
- })]
363
- }),
364
- h && /* @__PURE__ */ (0, S.jsx)("div", {
365
- className: "append-container",
366
- children: h
367
- }),
368
- !t && /* @__PURE__ */ (0, S.jsx)("div", {
369
- className: "advertise-with-us p-1",
370
- style: {
371
- backgroundColor: A.background_color || k?.background_color,
372
- color: A.font_color || k?.font_color,
373
- borderColor: A.border_color || k?.border_color
374
- },
375
- children: /* @__PURE__ */ (0, S.jsxs)(i, {
376
- className: "small d-block w-100 text-center",
377
- href: "https://articles.media/advertising",
378
- newPage: !0,
379
- children: [/* @__PURE__ */ (0, S.jsx)("i", { className: "fas fa-share me-1" }), "Advertise with Articles Media!"]
380
- })
381
- })
382
- ]
383
- });
384
- }
385
- var O = c(D);
386
- //#endregion
387
- export { O as t };
@@ -1 +0,0 @@
1
- const e=require(`./chunk-350yNsax.cjs`),t=require(`./classnames-pS64X3rL.cjs`),n=require(`./jsx-runtime-hCcDh67y.cjs`),r=require(`./Button-CbpRj01E.cjs`),i=require(`./Link-c7exNCJ3.cjs`),a=require(`./numberWithCommas-D9tgiUnq.cjs`);let o=require(`react`),s=require(`react-intersection-observer`),c=require(`swr`);c=e.n(c);let l=require(`date-fns`);var u=async e=>{if(process.env.NODE_ENV===`development`)try{let t=new URLSearchParams({ad_id:e.ad_id,user_ad_token:e.user_ad_token}).toString();return(await(await fetch(`http://localhost:3001/api/ads/${e.ad_id}?${t}`)).json()).result}catch{}let t=new URLSearchParams({ad_id:e.ad_id}).toString();return fetch(`${e.url}?${t}`).then(e=>e.json()).then(e=>e.result)},d={dedupingInterval:1e3*60*60},f=(e,t)=>{let{data:n,error:r,isLoading:i,mutate:a}=(0,c.default)(e?{url:`https://articles.media/api/ads/${e}`,ad_id:e,user_ad_token:t}:null,u,d);return{data:n,error:r,isLoading:i,mutate:a}},p=async e=>{if(process.env.NODE_ENV===`development`)try{return await(await fetch(`http://localhost:3001/api/ads`)).json()}catch{}return fetch(e.url).then(e=>e.json())},m=60,h={dedupingInterval:(0,l.minutesToMilliseconds)(m),focusThrottleInterval:(0,l.minutesToMilliseconds)(m)},g=e=>{let{data:t,error:n,isLoading:r,mutate:i}=(0,c.default)(e?.loading||e?.disabled?null:{url:`https://articles.media/api/ads`},p,h);return{data:t,error:n,isLoading:r,mutate:i}},_=n.t(),v=e.n(t.t(),1),y=(0,o.lazy)(()=>Promise.resolve().then(()=>require(`./AdDetailsModal-g0n7LiV6.cjs`))),b=(0,o.lazy)(()=>Promise.resolve().then(()=>require(`./AdConfirmExitModal-CRCnzYQM.cjs`)));function x(e,t){return Math.floor(Math.random()*(t-e+1))+e}function S(e){let{previewMode:t,darkMode:n,user_ad_token:c,userDetails:u,userDetailsLoading:d,prepend:p,append:m}=e,h=[],[S,C]=(0,o.useState)(null),{data:w,isLoading:T,mutate:E}=g({loading:d,disabled:u?.articles_membership?.status==`Active`}),{data:D,isLoading:O}=f(S,c),k=e.previewData||{},[ee,te]=(0,o.useState)(null),[ne,A]=(0,o.useState)(null),[j,M]=(0,o.useState)(null),[N,P]=(0,o.useState)(0),[F,I]=(0,o.useState)(!1),[L,R]=(0,o.useState)(!1),[z,B]=(0,o.useState)(!1),[V,H]=(0,o.useState)(new Date),[U,W]=(0,o.useState)([]);(0,o.useEffect)(()=>{w&&w?.length>0&&!S&&(console.log(`Ad Mounted or reduxAds changed`),C(e.ad_id||w[x(0,w?.length-1)]?._id))},[w]),(0,o.useEffect)(()=>{},[D]),(0,o.useEffect)(()=>{D?.populated_promos&&N>=0&&M(D?.populated_promos[N])},[N,D]);function G(){R(!L)}let{ref:K,inView:q,entry:re}=(0,s.useInView)({threshold:0,triggerOnce:!0});function J(e){if(t&&console.log(`Preventing this event from being logged as this ad is being shown in preview mode.`),U.find(t=>t==e)){console.log(`Already logged this event`);return}let n=new URLSearchParams({ad_id:D?._id,event:e}).toString();fetch(`/api/ads/event?${n}`).then(function(e){return e.json()}).then(function(t){W([...U,e]),console.log(t)}).catch(function(e){console.log(e)})}(0,o.useEffect)(()=>{if(!t&&(console.log(`inView`,q),q&&S)){let e=[{ad_id:S,date:new Date().toString()},...h.filter(e=>{if(console.log((0,l.differenceInMinutes)(new Date,new Date(e.date))),(0,l.differenceInMinutes)(new Date,new Date(e.date))>5){console.log(`adsViewed - Remove Old Ad View Object`);return}else return console.log(`adsViewed - Keep Ad View Object`),e})];console.log(`unexpiredRecentViews`,e)}},[q,S]);let[Y,X]=(0,o.useState)(null),[Z,Q]=(0,o.useState)(!1);function $(){Q(!0),console.log(`logAdAvoided called`,c);let e=process.env.NODE_ENV===`development`?`http://localhost:3001/api/user/advertising/avoided`:`https://articles.media/api/user/advertising/avoided`,t=new URLSearchParams({user_id:u?._id}).toString();fetch(`${e}?${t}`,{headers:{"x-articles-api-key":c}}).then(function(e){return e.json()}).then(function(e){Q(!1),X(e.avoided_count),console.log(e)}).catch(function(e){console.log(e),Q(!1)})}return(0,o.useEffect)(()=>{t||(console.log(`inView`,q),u?.articles_membership?.status==`Active`&&q&&$(`Ad Avoided`))},[q,u]),d?null:(0,_.jsxs)(`div`,{ref:K,className:(0,v.default)(`ad-wrap`,{"active-member":u?.articles_membership?.status==`Active`}),style:{"--articles-ad-background-color":k.background_color||D?.background_color,"--articles-ad-font-color":k.font_color||D?.font_color,"--articles-ad-border-color":k.border_color||D?.border_color},children:[L&&(0,_.jsx)(y,{setModalShow:R,ad:D,previewData:k}),z&&(0,_.jsx)(b,{setModalShow:B,ad:D,previewData:k}),p&&(0,_.jsx)(`div`,{className:`prepend-container`,children:p}),(0,_.jsxs)(`div`,{className:`ad`,children:[u?.articles_membership?.status!==`Active`&&(0,_.jsxs)(`div`,{className:`main-panel`,children:[(0,_.jsx)(`div`,{className:`ad-warning flex-header`,children:(0,_.jsxs)(`div`,{className:``,children:[D?.city&&`Local`,` Advertisement`]})}),(0,_.jsxs)(`div`,{className:`content-wrap`,children:[(0,_.jsxs)(`div`,{className:`photo-banner`,children:[(0,_.jsx)(`div`,{className:`logo`,children:(k.logo?.location||D?.logo?.location)&&(0,_.jsx)(`img`,{src:k?.logo?.key?`${process.env.NEXT_PUBLIC_CDN}${k?.logo?.key}`:`${process.env.NEXT_PUBLIC_CDN}${D?.logo?.key}`,alt:``})}),(0,_.jsx)(`div`,{className:`icon d-none`,children:(0,_.jsx)(`i`,{className:`fas fa-mug-hot`})}),(0,_.jsx)(`img`,{className:`photo`,src:k?.background?.key?`${process.env.NEXT_PUBLIC_CDN}${k.background?.key}`:`${process.env.NEXT_PUBLIC_CDN}${D?.background?.key}`,alt:``})]}),(0,_.jsxs)(`div`,{className:`details-wrap`,children:[(0,_.jsxs)(`div`,{className:`detail-title`,children:[(0,_.jsx)(`div`,{className:`detail`,children:(0,_.jsx)(`span`,{className:`h4`,children:k?.business||D?.business})}),(0,_.jsxs)(`div`,{className:`flex flex-column d-none`,children:[(0,_.jsxs)(`div`,{className:`detail`,children:[(0,_.jsx)(`span`,{className:`icon`,children:(0,_.jsx)(`i`,{className:`fas fa-search-location`})}),(0,_.jsxs)(`span`,{children:[D?.city,`, `,D?.state]})]}),(0,_.jsxs)(`div`,{className:`detail`,children:[(0,_.jsx)(`span`,{className:`icon`,children:(0,_.jsx)(`i`,{className:`fas fa-clock me-2`})}),(0,_.jsx)(`span`,{children:`6:30AM–8PM`})]})]})]}),D?.city&&(0,_.jsx)(`div`,{className:`details mb-3 d-none`}),(0,_.jsx)(`div`,{className:`short-description`,children:k?.description||D?.description})]})]}),(!1)?.roles?.isDev&&D?.populated_promos?.length>0&&(0,_.jsxs)(`div`,{children:[j&&(0,_.jsx)(`div`,{className:`promos-wrap`,children:j&&(0,_.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:[(0,_.jsxs)(`div`,{className:``,children:[(0,_.jsx)(`div`,{children:j.title}),(0,_.jsx)(`div`,{className:`small`,children:(0,_.jsx)(`div`,{className:`small`,children:j.details})})]}),(0,_.jsx)(r.t,{className:`px-3`,small:!0,onClick:()=>{console.log(`Load Save Modal`),I(!0)},children:`Save`})]},j._id)}),(0,_.jsxs)(`div`,{className:`d-flex justify-content-between`,children:[(0,_.jsxs)(`div`,{className:`px-2`,children:[D?.populated_promos?.length,` Promos Active`]}),(0,_.jsxs)(`div`,{className:`controls`,children:[(0,_.jsx)(`i`,{className:`fad fa-arrow-circle-left`,type:`button`,onClick:()=>{P(N==0?D?.populated_promos?.length-1:e=>e-1)}}),D?.populated_promos?.map((e,t)=>(0,_.jsx)(`i`,{className:`fa-square ${t==N?`fad`:`fas`}`},e._id)),(0,_.jsx)(`i`,{className:`fad fa-arrow-circle-right`,type:`button`,onClick:()=>{N==D?.populated_promos?.length-1?P(0):P(e=>e+1)}})]})]})]}),(0,_.jsx)(`hr`,{style:{borderColor:`white`},className:`mt-auto mb-0`}),(0,_.jsxs)(`div`,{className:`action-wrap d-flex justify-content-lg-between px-3 py-2`,children:[(0,_.jsx)(`div`,{onClick:()=>{G(),J(`Details`)},className:`action flex-grow-1 flex-shrink-0`,children:`Details`}),(0,_.jsx)(`span`,{className:`px-4`}),(0,_.jsx)(`a`,{className:`action flex-grow-1 flex-shrink-0`,href:D?.website,target:`_blank`,rel:`noreferrer`,onClick:e=>{e.preventDefault(),B(!0),J(`Confirm Exit Modal Opened`)},children:(0,_.jsx)(`div`,{children:`Website`})})]})]}),u?.articles_membership?.status==`Active`&&(0,_.jsx)(`div`,{className:`main-panel`,children:(0,_.jsxs)(`div`,{className:`content-wrap`,children:[(0,_.jsxs)(`div`,{className:`photo-banner`,children:[(0,_.jsx)(`div`,{className:`logo`}),(0,_.jsxs)(`div`,{className:`splash`,children:[(0,_.jsx)(`i`,{className:`fas fa-broadcast-tower`}),(0,_.jsxs)(`div`,{className:`text`,children:[(0,_.jsx)(`div`,{className:`count`,children:Z?(0,_.jsx)(`i`,{className:`fas fa-spinner fa-spin me-0`}):Y?a.t(Y):0}),(0,_.jsx)(`div`,{className:`label`,children:`ads avoided.`})]})]}),(0,_.jsxs)(`div`,{className:`member-since`,children:[`Member since: `,(0,_.jsx)(a.n,{format:`PP`,date:u?.articles_membership?.membership_started})]})]}),(0,_.jsxs)(`div`,{className:`details-wrap`,children:[(0,_.jsx)(`div`,{className:`detail-title`,children:(0,_.jsx)(`div`,{className:`detail`,children:(0,_.jsx)(`span`,{className:`h4`,children:`Thanks for the support!`})})}),(0,_.jsxs)(`div`,{className:`short-description`,children:[(0,_.jsx)(`div`,{className:`mb-2`,children:`Without support from users like you, we wouldn't be here.`}),(0,_.jsxs)(`div`,{className:`links-list`,children:[(0,_.jsxs)(i.t,{newPage:!0,className:`link-item`,href:`https://articles.media/messages`,children:[(0,_.jsx)(`i`,{className:`fas fa-comments-alt`}),`0 unread messages.`]}),(0,_.jsxs)(i.t,{newPage:!0,className:`link-item`,href:`https://articles.media/settings/notifications`,onClick:()=>{$()},children:[(0,_.jsx)(`i`,{className:`fas fa-bell`}),`0 notifications.`]}),(0,_.jsxs)(i.t,{newPage:!0,className:`link-item`,href:`https://articles.media/settings/account`,children:[(0,_.jsx)(`i`,{className:`fas fa-cog`}),`Manage account settings.`]})]})]})]})]})})]}),m&&(0,_.jsx)(`div`,{className:`append-container`,children:m}),!t&&(0,_.jsx)(`div`,{className:`advertise-with-us p-1`,style:{backgroundColor:k.background_color||D?.background_color,color:k.font_color||D?.font_color,borderColor:k.border_color||D?.border_color},children:(0,_.jsxs)(i.t,{className:`small d-block w-100 text-center`,href:`https://articles.media/advertising`,newPage:!0,children:[(0,_.jsx)(`i`,{className:`fas fa-share me-1`}),`Advertise with Articles Media!`]})})]})}var C=(0,o.memo)(S);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return C}});
package/dist/Ad.cjs DELETED
@@ -1 +0,0 @@
1
- const e=require(`./Ad-DYtftKNV.cjs`);module.exports=e.t;
@@ -1,56 +0,0 @@
1
- import { t as e } from "./jsx-runtime-VZk6y-ec.js";
2
- import { t } from "./Button-BlAdEbSd.js";
3
- import { t as n } from "./Link-MFZblBb4.js";
4
- import { t as r } from "./Modal-BX1s6CCU.js";
5
- import { useEffect as i } from "react";
6
- //#region src/components/Ads/AdConfirmExitModal.jsx
7
- var a = e();
8
- function o(e) {
9
- let { setModalShow: o, ad: s, previewData: c } = e;
10
- i(() => {
11
- console.log("Mounted");
12
- }, []);
13
- let l = () => {
14
- o(!1);
15
- };
16
- return /* @__PURE__ */ (0, a.jsx)("div", { children: /* @__PURE__ */ (0, a.jsxs)(r, {
17
- show: !0,
18
- backdropClassName: "ad-details-modal-backdrop",
19
- className: "articles-modal",
20
- centered: !0,
21
- onHide: l,
22
- size: "md",
23
- children: [
24
- /* @__PURE__ */ (0, a.jsx)(r.Header, {
25
- className: "align-items-center",
26
- closeButton: !0,
27
- children: /* @__PURE__ */ (0, a.jsx)(r.Title, { children: "Confirm Exit" })
28
- }),
29
- /* @__PURE__ */ (0, a.jsxs)(r.Body, {
30
- className: "",
31
- children: [/* @__PURE__ */ (0, a.jsx)("div", { className: "ratio ratio-16x9 bg-black mb-2" }), /* @__PURE__ */ (0, a.jsx)("p", {
32
- className: "mb-1",
33
- children: "This advertiser has been approved and verified to display ads but always be cautious when interacting with ads. Any offsite interactions are at your own risk and should be approached with caution. We can not be held responsible for any issues that may arise."
34
- })]
35
- }),
36
- /* @__PURE__ */ (0, a.jsxs)(r.Footer, {
37
- className: "d-flex justify-content-between",
38
- children: [/* @__PURE__ */ (0, a.jsxs)(t, {
39
- variant: "articles",
40
- onClick: l,
41
- children: [/* @__PURE__ */ (0, a.jsx)("i", { className: "fad fa-times" }), "Close"]
42
- }), /* @__PURE__ */ (0, a.jsx)(n, {
43
- href: s?.website,
44
- newPage: !0,
45
- children: /* @__PURE__ */ (0, a.jsxs)(t, {
46
- variant: "articles",
47
- onClick: l,
48
- children: [/* @__PURE__ */ (0, a.jsx)("i", { className: "fad fa-link" }), "Proceed"]
49
- })
50
- })]
51
- })
52
- ]
53
- }) });
54
- }
55
- //#endregion
56
- export { o as default };
@@ -1 +0,0 @@
1
- require(`./chunk-350yNsax.cjs`);const e=require(`./jsx-runtime-hCcDh67y.cjs`),t=require(`./Button-CbpRj01E.cjs`),n=require(`./Link-c7exNCJ3.cjs`),r=require(`./Modal-DP9CeAVD.cjs`);let i=require(`react`);var a=e.t();function o(e){let{setModalShow:o,ad:s,previewData:c}=e;(0,i.useEffect)(()=>{console.log(`Mounted`)},[]);let l=()=>{o(!1)};return(0,a.jsx)(`div`,{children:(0,a.jsxs)(r.t,{show:!0,backdropClassName:`ad-details-modal-backdrop`,className:`articles-modal`,centered:!0,onHide:l,size:`md`,children:[(0,a.jsx)(r.t.Header,{className:`align-items-center`,closeButton:!0,children:(0,a.jsx)(r.t.Title,{children:`Confirm Exit`})}),(0,a.jsxs)(r.t.Body,{className:``,children:[(0,a.jsx)(`div`,{className:`ratio ratio-16x9 bg-black mb-2`}),(0,a.jsx)(`p`,{className:`mb-1`,children:`This advertiser has been approved and verified to display ads but always be cautious when interacting with ads. Any offsite interactions are at your own risk and should be approached with caution. We can not be held responsible for any issues that may arise.`})]}),(0,a.jsxs)(r.t.Footer,{className:`d-flex justify-content-between`,children:[(0,a.jsxs)(t.t,{variant:`articles`,onClick:l,children:[(0,a.jsx)(`i`,{className:`fad fa-times`}),`Close`]}),(0,a.jsx)(n.t,{href:s?.website,newPage:!0,children:(0,a.jsxs)(t.t,{variant:`articles`,onClick:l,children:[(0,a.jsx)(`i`,{className:`fad fa-link`}),`Proceed`]})})]})]})})}exports.default=o;