@articles-media/articles-dev-box 1.0.27 → 1.0.29

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
@@ -39,6 +39,8 @@ npm run dev
39
39
  - For bringing users back to their state in the games showcase/launcher
40
40
  - SignInButton
41
41
  - For bringing users to the accounts service to login at and redirecting back
42
+ - SessionButton
43
+ - Button that manages sign in, sign out, and account details.
42
44
  - GameScoreboard
43
45
  - Scoreboard for registered games that links with a user's Articles Media account.
44
46
  - Ad
@@ -55,6 +57,10 @@ npm run dev
55
57
  - All in one component to handle game credits UI across multiple games.
56
58
  - DarkModeHandler
57
59
  - Consumes a Zustand store, detects prefers-color-scheme, sets data-bs-theme on body element.
60
+ - ToontownModeHandler
61
+ - Handles setting zustand state from url params if toontownMode is passed.
62
+ - SocketServerUrlHandler
63
+ - Handles setting socket server state from url params if socketServerUrl is passed.
58
64
  - useUserToken
59
65
  - Hook for getting the subdomain auth token.
60
66
  - useUserDetails
@@ -1,21 +1,40 @@
1
1
  import { n as e, t } from "./classnames-DCsil9eG.js";
2
- import { t as n } from "./Button-C8R7Qxqb.js";
2
+ import { t as n } from "./Button-sSB4xpOw.js";
3
3
  import { t as r } from "./Link-8nSDV4sI.js";
4
- import { n as i, o as a, r as o, s, t as c } from "./numberWithCommas-DXxghuXP.js";
4
+ import { n as i, o as a, r as o, s, t as c } from "./numberWithCommas-DSRplpBy.js";
5
5
  import * as l from "react";
6
6
  import { lazy as u, memo as d, useEffect as f, useState as p } from "react";
7
7
  import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
8
  import g from "swr";
9
+ //#region node_modules/date-fns/_lib/getRoundingMethod.js
10
+ function _(e) {
11
+ return (t) => {
12
+ let n = (e ? Math[e] : Math.trunc)(t);
13
+ return n === 0 ? 0 : n;
14
+ };
15
+ }
16
+ //#endregion
17
+ //#region node_modules/date-fns/differenceInMilliseconds.js
18
+ function v(e, t) {
19
+ return a(e) - +a(t);
20
+ }
21
+ //#endregion
22
+ //#region node_modules/date-fns/differenceInMinutes.js
23
+ function y(e, t, n) {
24
+ let r = v(e, t) / s;
25
+ return _(n?.roundingMethod)(r);
26
+ }
27
+ //#endregion
9
28
  //#region node_modules/react-intersection-observer/dist/index.mjs
10
- var _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new WeakMap(), y = 0, b;
11
- function x(e) {
12
- return e ? v.has(e) ? v.get(e) : (y += 1, v.set(e, y.toString()), v.get(e)) : "0";
29
+ var b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new WeakMap(), S = 0, C;
30
+ function w(e) {
31
+ return e ? x.has(e) ? x.get(e) : (S += 1, x.set(e, S.toString()), x.get(e)) : "0";
13
32
  }
14
- function S(e) {
15
- return Object.keys(e).sort().filter((t) => e[t] !== void 0).map((t) => `${t}_${t === "root" ? x(e.root) : e[t]}`).toString();
33
+ function T(e) {
34
+ return Object.keys(e).sort().filter((t) => e[t] !== void 0).map((t) => `${t}_${t === "root" ? w(e.root) : e[t]}`).toString();
16
35
  }
17
- function C(e) {
18
- let t = S(e), n = _.get(t);
36
+ function E(e) {
37
+ let t = T(e), n = b.get(t);
19
38
  if (!n) {
20
39
  let r = /* @__PURE__ */ new Map(), i, a = new IntersectionObserver((t) => {
21
40
  t.forEach((t) => {
@@ -30,11 +49,11 @@ function C(e) {
30
49
  id: t,
31
50
  observer: a,
32
51
  elements: r
33
- }, _.set(t, n);
52
+ }, b.set(t, n);
34
53
  }
35
54
  return n;
36
55
  }
37
- function w(e, t, n = {}, r = b) {
56
+ function D(e, t, n = {}, r = C) {
38
57
  if (window.IntersectionObserver === void 0 && r !== void 0) {
39
58
  let i = e.getBoundingClientRect();
40
59
  return t(r, {
@@ -47,13 +66,13 @@ function w(e, t, n = {}, r = b) {
47
66
  rootBounds: i
48
67
  }), () => {};
49
68
  }
50
- let { id: i, observer: a, elements: o } = C(n), s = o.get(e) || [];
69
+ let { id: i, observer: a, elements: o } = E(n), s = o.get(e) || [];
51
70
  return o.has(e) || o.set(e, s), s.push(t), a.observe(e), function() {
52
- s.splice(s.indexOf(t), 1), s.length === 0 && (o.delete(e), a.unobserve(e)), o.size === 0 && (a.disconnect(), _.delete(i));
71
+ s.splice(s.indexOf(t), 1), s.length === 0 && (o.delete(e), a.unobserve(e)), o.size === 0 && (a.disconnect(), b.delete(i));
53
72
  };
54
73
  }
55
74
  l.Component;
56
- function T({ threshold: e, delay: t, trackVisibility: n, rootMargin: r, root: i, triggerOnce: a, skip: o, initialInView: s, fallbackInView: c, onChange: u } = {}) {
75
+ function O({ threshold: e, delay: t, trackVisibility: n, rootMargin: r, root: i, triggerOnce: a, skip: o, initialInView: s, fallbackInView: c, onChange: u } = {}) {
57
76
  let [d, f] = l.useState(null), p = l.useRef(u), m = l.useRef(s), [h, g] = l.useState({
58
77
  inView: !!s,
59
78
  entry: void 0
@@ -61,7 +80,7 @@ function T({ threshold: e, delay: t, trackVisibility: n, rootMargin: r, root: i,
61
80
  p.current = u, l.useEffect(() => {
62
81
  if (m.current === void 0 && (m.current = s), o || !d) return;
63
82
  let l;
64
- return l = w(d, (e, t) => {
83
+ return l = D(d, (e, t) => {
65
84
  let n = m.current;
66
85
  m.current = e, !(n === void 0 && !e) && (g({
67
86
  inView: e,
@@ -102,7 +121,7 @@ function T({ threshold: e, delay: t, trackVisibility: n, rootMargin: r, root: i,
102
121
  l.useInsertionEffect ?? l.useLayoutEffect ?? l.useEffect;
103
122
  //#endregion
104
123
  //#region src/hooks/Ads/useAd.js
105
- var E = async (e) => {
124
+ var ee = async (e) => {
106
125
  if (process.env.NODE_ENV === "development") try {
107
126
  let t = new URLSearchParams({
108
127
  ad_id: e.ad_id,
@@ -112,44 +131,22 @@ var E = async (e) => {
112
131
  } catch {}
113
132
  let t = new URLSearchParams({ ad_id: e.ad_id }).toString();
114
133
  return fetch(`${e.url}?${t}`).then((e) => e.json()).then((e) => e.result);
115
- }, ee = {
134
+ }, te = {
116
135
  dedupingInterval: 1e3 * 60 * 60,
117
136
  errorRetryInterval: 1e3 * 60 * 5
118
- }, te = (e, t) => {
137
+ }, k = (e, t) => {
119
138
  let { data: n, error: r, isLoading: i, mutate: a } = g(e ? {
120
139
  url: `https://articles.media/api/ads/${e}`,
121
140
  ad_id: e,
122
141
  user_ad_token: t
123
- } : null, E, ee);
142
+ } : null, ee, te);
124
143
  return {
125
144
  data: n,
126
145
  error: r,
127
146
  isLoading: i,
128
147
  mutate: a
129
148
  };
130
- };
131
- //#endregion
132
- //#region node_modules/date-fns/_lib/getRoundingMethod.js
133
- function D(e) {
134
- return (t) => {
135
- let n = (e ? Math[e] : Math.trunc)(t);
136
- return n === 0 ? 0 : n;
137
- };
138
- }
139
- //#endregion
140
- //#region node_modules/date-fns/differenceInMilliseconds.js
141
- function O(e, t) {
142
- return a(e) - +a(t);
143
- }
144
- //#endregion
145
- //#region node_modules/date-fns/differenceInMinutes.js
146
- function k(e, t, n) {
147
- let r = O(e, t) / s;
148
- return D(n?.roundingMethod)(r);
149
- }
150
- //#endregion
151
- //#region src/hooks/Ads/useAds.js
152
- var A = async (e) => {
149
+ }, A = async (e) => {
153
150
  if (process.env.NODE_ENV === "development") try {
154
151
  return await (await fetch("http://localhost:3001/api/ads")).json();
155
152
  } catch {}
@@ -166,24 +163,24 @@ var A = async (e) => {
166
163
  isLoading: r,
167
164
  mutate: i
168
165
  };
169
- }, P = /* @__PURE__ */ e(t(), 1), F = u(() => import("./AdDetailsModal-FPwnBWKy.js")), I = u(() => import("./AdConfirmExitModal-BiIXNJwG.js"));
166
+ }, P = /* @__PURE__ */ e(t(), 1), F = u(() => import("./AdDetailsModal-CdTR2Y9l.js")), I = u(() => import("./AdConfirmExitModal-skW9lp88.js"));
170
167
  function L(e, t) {
171
168
  return Math.floor(Math.random() * (t - e + 1)) + e;
172
169
  }
173
170
  function R(e) {
174
- let { previewMode: t, darkMode: a, user_ad_token: o, userDetails: s, userDetailsLoading: l, prepend: u, append: d } = e, g = [], [_, v] = p(null), { data: y, isLoading: b, mutate: x } = N({
171
+ let { previewMode: t, darkMode: a, user_ad_token: o, userDetails: s, userDetailsLoading: l, prepend: u, append: d } = e, g = [], [_, v] = p(null), { data: b, isLoading: x, mutate: S } = N({
175
172
  loading: l,
176
173
  disabled: s?.articles_membership?.status == "Active"
177
- }), { data: S, isLoading: C } = te(_, o), w = e.previewData || {}, [E, ee] = p(null), [D, O] = p(null), [A, j] = p(null), [M, R] = p(0), [z, B] = p(!1), [V, H] = p(!1), [U, W] = p(!1), [ne, re] = p(/* @__PURE__ */ new Date()), [G, K] = p([]);
174
+ }), { data: C, isLoading: w } = k(_, o), T = e.previewData || {}, [E, D] = p(null), [ee, te] = p(null), [A, j] = p(null), [M, R] = p(0), [z, B] = p(!1), [V, H] = p(!1), [U, W] = p(!1), [ne, re] = p(/* @__PURE__ */ new Date()), [G, K] = p([]);
178
175
  f(() => {
179
- y && y?.length > 0 && !_ && (console.log("Ad Mounted or reduxAds changed"), v(e.ad_id || y[L(0, y?.length - 1)]?._id));
180
- }, [y]), f(() => {}, [S]), f(() => {
181
- S?.populated_promos && M >= 0 && j(S?.populated_promos[M]);
182
- }, [M, S]);
176
+ b && b?.length > 0 && !_ && (console.log("Ad Mounted or reduxAds changed"), v(e.ad_id || b[L(0, b?.length - 1)]?._id));
177
+ }, [b]), f(() => {}, [C]), f(() => {
178
+ C?.populated_promos && M >= 0 && j(C?.populated_promos[M]);
179
+ }, [M, C]);
183
180
  function q() {
184
181
  H(!V);
185
182
  }
186
- let { ref: J, inView: Y, entry: ie } = T({
183
+ let { ref: J, inView: Y, entry: ie } = O({
187
184
  threshold: 0,
188
185
  triggerOnce: !0
189
186
  });
@@ -193,7 +190,7 @@ function R(e) {
193
190
  return;
194
191
  }
195
192
  let n = new URLSearchParams({
196
- ad_id: S?._id,
193
+ ad_id: C?._id,
197
194
  event: e
198
195
  }).toString();
199
196
  fetch(`/api/ads/event?${n}`).then(function(e) {
@@ -210,7 +207,7 @@ function R(e) {
210
207
  ad_id: _,
211
208
  date: (/* @__PURE__ */ new Date()).toString()
212
209
  }, ...g.filter((e) => {
213
- if (console.log(k(/* @__PURE__ */ new Date(), new Date(e.date))), k(/* @__PURE__ */ new Date(), new Date(e.date)) > 5) {
210
+ if (console.log(y(/* @__PURE__ */ new Date(), new Date(e.date))), y(/* @__PURE__ */ new Date(), new Date(e.date)) > 5) {
214
211
  console.log("adsViewed - Remove Old Ad View Object");
215
212
  return;
216
213
  } else return console.log("adsViewed - Keep Ad View Object"), e;
@@ -236,20 +233,20 @@ function R(e) {
236
233
  ref: J,
237
234
  className: (0, P.default)("ad-wrap", { "active-member": s?.articles_membership?.status == "Active" }),
238
235
  style: {
239
- "--articles-ad-background-color": w.background_color || S?.background_color,
240
- "--articles-ad-font-color": w.font_color || S?.font_color,
241
- "--articles-ad-border-color": w.border_color || S?.border_color
236
+ "--articles-ad-background-color": T.background_color || C?.background_color,
237
+ "--articles-ad-font-color": T.font_color || C?.font_color,
238
+ "--articles-ad-border-color": T.border_color || C?.border_color
242
239
  },
243
240
  children: [
244
241
  V && /* @__PURE__ */ m(F, {
245
242
  setModalShow: H,
246
- ad: S,
247
- previewData: w
243
+ ad: C,
244
+ previewData: T
248
245
  }),
249
246
  U && /* @__PURE__ */ m(I, {
250
247
  setModalShow: W,
251
- ad: S,
252
- previewData: w
248
+ ad: C,
249
+ previewData: T
253
250
  }),
254
251
  u && /* @__PURE__ */ m("div", {
255
252
  className: "prepend-container",
@@ -264,7 +261,7 @@ function R(e) {
264
261
  className: "ad-warning flex-header",
265
262
  children: /* @__PURE__ */ h("div", {
266
263
  className: "",
267
- children: [S?.city && "Local", " Advertisement"]
264
+ children: [C?.city && "Local", " Advertisement"]
268
265
  })
269
266
  }),
270
267
  /* @__PURE__ */ h("div", {
@@ -274,8 +271,8 @@ function R(e) {
274
271
  children: [
275
272
  /* @__PURE__ */ m("div", {
276
273
  className: "logo",
277
- children: (w.logo?.location || S?.logo?.location) && /* @__PURE__ */ m("img", {
278
- src: w?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${w?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${S?.logo?.key}`,
274
+ children: (T.logo?.location || C?.logo?.location) && /* @__PURE__ */ m("img", {
275
+ src: T?.logo?.key ? `${process.env.NEXT_PUBLIC_CDN}${T?.logo?.key}` : `${process.env.NEXT_PUBLIC_CDN}${C?.logo?.key}`,
279
276
  alt: ""
280
277
  })
281
278
  }),
@@ -285,7 +282,7 @@ function R(e) {
285
282
  }),
286
283
  /* @__PURE__ */ m("img", {
287
284
  className: "photo",
288
- src: w?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${w.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${S?.background?.key}`,
285
+ src: T?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${T.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${C?.background?.key}`,
289
286
  alt: ""
290
287
  })
291
288
  ]
@@ -298,7 +295,7 @@ function R(e) {
298
295
  className: "detail",
299
296
  children: /* @__PURE__ */ m("span", {
300
297
  className: "h4",
301
- children: w?.business || S?.business
298
+ children: T?.business || C?.business
302
299
  })
303
300
  }), /* @__PURE__ */ h("div", {
304
301
  className: "flex flex-column d-none",
@@ -308,9 +305,9 @@ function R(e) {
308
305
  className: "icon",
309
306
  children: /* @__PURE__ */ m("i", { className: "fas fa-search-location" })
310
307
  }), /* @__PURE__ */ h("span", { children: [
311
- S?.city,
308
+ C?.city,
312
309
  ", ",
313
- S?.state
310
+ C?.state
314
311
  ] })]
315
312
  }), /* @__PURE__ */ h("div", {
316
313
  className: "detail",
@@ -321,15 +318,15 @@ function R(e) {
321
318
  })]
322
319
  })]
323
320
  }),
324
- S?.city && /* @__PURE__ */ m("div", { className: "details mb-3 d-none" }),
321
+ C?.city && /* @__PURE__ */ m("div", { className: "details mb-3 d-none" }),
325
322
  /* @__PURE__ */ m("div", {
326
323
  className: "short-description",
327
- children: w?.description || S?.description
324
+ children: T?.description || C?.description
328
325
  })
329
326
  ]
330
327
  })]
331
328
  }),
332
- (!1)?.roles?.isDev && S?.populated_promos?.length > 0 && /* @__PURE__ */ h("div", { children: [A && /* @__PURE__ */ m("div", {
329
+ (!1)?.roles?.isDev && C?.populated_promos?.length > 0 && /* @__PURE__ */ h("div", { children: [A && /* @__PURE__ */ m("div", {
333
330
  className: "promos-wrap",
334
331
  children: A && /* @__PURE__ */ h("div", {
335
332
  className: "promo-wrap d-flex justify-content-between align-items-center mx-2 p-1 px-2 border border-2 border-light mb-0",
@@ -355,7 +352,7 @@ function R(e) {
355
352
  className: "d-flex justify-content-between",
356
353
  children: [/* @__PURE__ */ h("div", {
357
354
  className: "px-2",
358
- children: [S?.populated_promos?.length, " Promos Active"]
355
+ children: [C?.populated_promos?.length, " Promos Active"]
359
356
  }), /* @__PURE__ */ h("div", {
360
357
  className: "controls",
361
358
  children: [
@@ -363,15 +360,15 @@ function R(e) {
363
360
  className: "fad fa-arrow-circle-left",
364
361
  type: "button",
365
362
  onClick: () => {
366
- R(M == 0 ? S?.populated_promos?.length - 1 : (e) => e - 1);
363
+ R(M == 0 ? C?.populated_promos?.length - 1 : (e) => e - 1);
367
364
  }
368
365
  }),
369
- S?.populated_promos?.map((e, t) => /* @__PURE__ */ m("i", { className: `fa-square ${t == M ? "fad" : "fas"}` }, e._id)),
366
+ C?.populated_promos?.map((e, t) => /* @__PURE__ */ m("i", { className: `fa-square ${t == M ? "fad" : "fas"}` }, e._id)),
370
367
  /* @__PURE__ */ m("i", {
371
368
  className: "fad fa-arrow-circle-right",
372
369
  type: "button",
373
370
  onClick: () => {
374
- M == S?.populated_promos?.length - 1 ? R(0) : R((e) => e + 1);
371
+ M == C?.populated_promos?.length - 1 ? R(0) : R((e) => e + 1);
375
372
  }
376
373
  })
377
374
  ]
@@ -394,7 +391,7 @@ function R(e) {
394
391
  /* @__PURE__ */ m("span", { className: "px-4" }),
395
392
  /* @__PURE__ */ m("a", {
396
393
  className: "action flex-grow-1 flex-shrink-0",
397
- href: S?.website,
394
+ href: C?.website,
398
395
  target: "_blank",
399
396
  rel: "noreferrer",
400
397
  onClick: (e) => {
@@ -488,9 +485,9 @@ function R(e) {
488
485
  !t && /* @__PURE__ */ m("div", {
489
486
  className: "advertise-with-us p-1",
490
487
  style: {
491
- backgroundColor: w.background_color || S?.background_color,
492
- color: w.font_color || S?.font_color,
493
- borderColor: w.border_color || S?.border_color
488
+ backgroundColor: T.background_color || C?.background_color,
489
+ color: T.font_color || C?.font_color,
490
+ borderColor: T.border_color || C?.border_color
494
491
  },
495
492
  children: /* @__PURE__ */ h(r, {
496
493
  className: "small d-block w-100 text-center",
package/dist/Ad.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./Ad-DW52TMZ4.js";
1
+ import { t as e } from "./Ad-CFuDgQYL.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
2
  import { t } from "./Link-8nSDV4sI.js";
3
3
  import { useEffect as n } from "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
2
  import { t } from "./Link-8nSDV4sI.js";
3
3
  import { useEffect as n } from "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
@@ -3,12 +3,13 @@ import { forwardRef as n } from "react";
3
3
  import { jsx as r } from "react/jsx-runtime";
4
4
  //#region src/components/UI/Button.jsx
5
5
  var i = /* @__PURE__ */ e(t(), 1), a = n((e, t) => {
6
- let { size: n, variant: a, style: o, small: s, large: c, onClick: l, className: u, disabled: d, active: f, type: p, onMouseDown: m, onMouseUp: h, onMouseLeave: g, onTouchStart: _, onTouchEnd: v, ...y } = e;
6
+ let { size: n, variant: a, style: o, small: s, large: c, onClick: l, className: u, disabled: d, active: f, type: p, onMouseDown: m, onMouseUp: h, onMouseLeave: g, onTouchStart: _, onTouchEnd: v, title: y, ...b } = e;
7
7
  return /* @__PURE__ */ r("button", {
8
8
  ref: t,
9
9
  ...p && { type: "submit" },
10
10
  disabled: d,
11
11
  style: o,
12
+ title: y,
12
13
  onMouseDown: m,
13
14
  onMouseUp: h,
14
15
  onMouseLeave: g,
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
2
  import { useState as t } from "react";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  import { Modal as i } from "react-bootstrap";
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
2
  import t from "./useUserFriends.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  import { Modal as i } from "react-bootstrap";
@@ -1,5 +1,5 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
2
- import { t } from "./ViewUserModal-CrGeXxWG.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
+ import { t } from "./ViewUserModal-C5gjfuJ5.js";
3
3
  import { useEffect as n, useState as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  import o from "swr";
@@ -1,2 +1,2 @@
1
- import { t as e } from "./GameScoreboard-pTQKozrD.js";
1
+ import { t as e } from "./GameScoreboard-9GYlLx72.js";
2
2
  export { e as default };
@@ -4,7 +4,7 @@ import { n, t as r } from "./useAuthSiteStatus-Cj9IjMj7.js";
4
4
  import { Suspense as i, lazy as a, memo as o, useState as s } from "react";
5
5
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
6
  //#region src/components/Global/GlobalBody.jsx
7
- var d = /* @__PURE__ */ e(t(), 1), f = a(() => import("./StatusModal-BrBJnAXD.js"));
7
+ var d = /* @__PURE__ */ e(t(), 1), f = a(() => import("./StatusModal-PG3i9NKf.js"));
8
8
  function p(e) {
9
9
  let [t, a] = s(!1), { data: o, error: p, isLoading: m, mutate: h } = n({ disable: process.env.NODE_ENV !== "development" }), { data: g, error: _, isLoading: v, mutate: y } = r({ disable: process.env.NODE_ENV !== "development" });
10
10
  return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("link", {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t as e } from "./Button-C8R7Qxqb.js";
2
+ import { t as e } from "./Button-sSB4xpOw.js";
3
3
  import { useEffect as t, useState as n } from "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  //#region src/components/Games/ReturnToLauncherButton.jsx
@@ -0,0 +1,46 @@
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
+ import t from "./SignInButton.js";
3
+ import n from "./useUserDetails.js";
4
+ import r from "./useUserToken.js";
5
+ import { t as i } from "./ViewUserModal-C5gjfuJ5.js";
6
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ //#region src/components/User/SessionButton.jsx
8
+ function c({ port: c }) {
9
+ let { data: l, error: u, isLoading: d, mutate: f } = r(c), { data: p, error: m, isLoading: h, mutate: g } = n({ token: l });
10
+ return /* @__PURE__ */ o(a, { children: p ? /* @__PURE__ */ s("div", {
11
+ className: "w-100 d-flex align-items-stretch mb-2",
12
+ children: [/* @__PURE__ */ o(i, {
13
+ buttonType: "Link",
14
+ className: "w-100",
15
+ children: /* @__PURE__ */ s(e, {
16
+ className: "w-100",
17
+ small: !0,
18
+ onClick: () => {
19
+ console.log("userDetails", p);
20
+ },
21
+ children: [
22
+ /* @__PURE__ */ o("i", { className: "fad fa-sign-out" }),
23
+ "Logged in as ",
24
+ p?.display_name || "Unknown User"
25
+ ]
26
+ })
27
+ }), /* @__PURE__ */ o(e, {
28
+ className: "",
29
+ small: !0,
30
+ title: "Sign out",
31
+ onClick: () => {
32
+ fetch("/api/signout", {
33
+ method: "GET",
34
+ headers: {}
35
+ }).then((e) => e.json()).then((e) => {
36
+ console.log("Logout successful:", e), f(null), g(null);
37
+ }).catch((e) => {
38
+ console.error("Logout error:", e);
39
+ });
40
+ },
41
+ children: /* @__PURE__ */ o("i", { className: "fad fa-sign-out" })
42
+ })]
43
+ }) : /* @__PURE__ */ o(t, { className: "mb-2" }) });
44
+ }
45
+ //#endregion
46
+ export { c as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
2
  import { useState as t } from "react";
3
3
  import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  import { Form as a, Modal as o } from "react-bootstrap";
@@ -95,46 +95,58 @@ function c({ useAudioStore: t, config: o }) {
95
95
  }
96
96
  //#endregion
97
97
  //#region src/components/Games/Settings/MultiplayerTab.jsx
98
- function l({ useStore: t }) {
99
- let n = t((e) => e.socketServerHost), o = t((e) => e.setSocketServerHost);
100
- return /* @__PURE__ */ i("div", {
101
- className: "p-2",
102
- children: [
103
- /* @__PURE__ */ r(a.Label, {
104
- className: "mb-0",
105
- children: "Socket Server Host"
106
- }),
107
- /* @__PURE__ */ r(a.Control, {
108
- type: "text",
109
- value: n,
110
- onChange: (e) => o(e.target.value)
111
- }),
112
- /* @__PURE__ */ r(a.Label, {
113
- className: "mb-0",
114
- children: "Edit this to connect to a different multiplayer host!"
115
- }),
116
- /* @__PURE__ */ i("div", {
117
- className: "mt-3",
118
- children: [/* @__PURE__ */ r(e, {
119
- className: "mb-1",
120
- children: "Retry"
121
- }), /* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
122
- className: "badge bg-danger",
123
- children: "Offline"
124
- })] })]
125
- })
126
- ]
98
+ function l({ useStore: e, config: t }) {
99
+ return /* @__PURE__ */ r("div", {
100
+ className: "",
101
+ children: e && /* @__PURE__ */ r(u, { useStore: e })
127
102
  });
128
103
  }
104
+ function u({ useStore: t }) {
105
+ let n = t((e) => e.serverUrl), o = t((e) => e.setServerUrl), s = t((e) => e.connected), c = t((e) => e.connectSocket), l = t((e) => e.disconnectSocket);
106
+ return /* @__PURE__ */ i("div", { children: [
107
+ /* @__PURE__ */ i(a.Label, {
108
+ className: "mb-0",
109
+ children: [/* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
110
+ className: `badge ${s ? "bg-success" : "bg-danger"}`,
111
+ children: s ? "Online" : "Offline"
112
+ })] }), "Socket Server Host"]
113
+ }),
114
+ /* @__PURE__ */ r(a.Control, {
115
+ type: "text",
116
+ value: n,
117
+ onChange: (e) => o(e.target.value)
118
+ }),
119
+ /* @__PURE__ */ r(a.Label, {
120
+ className: "mb-0",
121
+ children: "Edit this to connect to a different multiplayer host!"
122
+ }),
123
+ /* @__PURE__ */ r("div", {
124
+ className: "mt-3",
125
+ children: s ? /* @__PURE__ */ r(e, {
126
+ className: "",
127
+ onClick: () => {
128
+ l();
129
+ },
130
+ children: "Disconnect"
131
+ }) : /* @__PURE__ */ r(e, {
132
+ className: "",
133
+ onClick: () => {
134
+ c();
135
+ },
136
+ children: "Connect"
137
+ })
138
+ })
139
+ ] });
140
+ }
129
141
  //#endregion
130
142
  //#region src/components/Games/Settings/ControlsTab.jsx
131
- function u({ useTouchControlsStore: e }) {
143
+ function d({ useTouchControlsStore: e }) {
132
144
  return /* @__PURE__ */ r("div", {
133
145
  className: "",
134
- children: e && /* @__PURE__ */ r(d, { useTouchControlsStore: e })
146
+ children: e && /* @__PURE__ */ r(f, { useTouchControlsStore: e })
135
147
  });
136
148
  }
137
- function d({ useTouchControlsStore: t }) {
149
+ function f({ useTouchControlsStore: t }) {
138
150
  let n = t((e) => e?.enabled), a = t((e) => e?.setEnabled);
139
151
  return /* @__PURE__ */ i("div", {
140
152
  className: "mb-3",
@@ -159,7 +171,7 @@ function d({ useTouchControlsStore: t }) {
159
171
  }
160
172
  //#endregion
161
173
  //#region src/components/Games/Settings/OtherTab.jsx
162
- function f({ useStore: t, config: a, children: o }) {
174
+ function p({ useStore: t, config: a, children: o }) {
163
175
  let s = t((e) => e?.debug), c = t((e) => e?.setDebug), l = t((e) => e?.toontownMode), u = t((e) => e?.setToontownMode);
164
176
  return /* @__PURE__ */ i(n, { children: [
165
177
  /* @__PURE__ */ r("div", { children: "Debug Mode" }),
@@ -201,11 +213,11 @@ function f({ useStore: t, config: a, children: o }) {
201
213
  }
202
214
  //#endregion
203
215
  //#region src/components/Games/Settings/SettingsModal.jsx
204
- function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsStore: m, config: h }) {
205
- let [g, _] = t(!1), [v, y] = t(localStorage.getItem("articles_settings_tab") || "Graphics"), b = (e) => {
206
- y(e), localStorage.setItem("articles_settings_tab", e);
216
+ function m({ show: n, setShow: a, store: u, useAudioStore: f, useTouchControlsStore: m, useSocketStore: h, config: g }) {
217
+ let [_, v] = t(!1), [y, b] = t(localStorage.getItem("articles_settings_tab") || "Graphics"), x = (e) => {
218
+ b(e), localStorage.setItem("articles_settings_tab", e);
207
219
  };
208
- return d((e) => e.darkMode), d((e) => e.setDarkMode), d((e) => e.arcadeMode), d((e) => e.setArcadeMode), /* @__PURE__ */ i(o, {
220
+ return u((e) => e.darkMode), u((e) => e.setDarkMode), u((e) => e.arcadeMode), u((e) => e.setArcadeMode), /* @__PURE__ */ i(o, {
209
221
  className: "articles-modal",
210
222
  size: "md",
211
223
  show: n,
@@ -232,37 +244,37 @@ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsSt
232
244
  "Multiplayer",
233
245
  "Other"
234
246
  ].map((t) => /* @__PURE__ */ r(e, {
235
- active: v == t,
247
+ active: y == t,
236
248
  onClick: () => {
237
- b(t);
249
+ x(t);
238
250
  },
239
251
  children: t
240
252
  }, t))
241
253
  }),
242
254
  /* @__PURE__ */ r("hr", { className: "my-0" }),
243
255
  /* @__PURE__ */ i("div", {
244
- className: "p-2",
256
+ className: "p-3",
245
257
  children: [
246
- v == "Controls" && /* @__PURE__ */ r(u, {
247
- useStore: d,
258
+ y == "Controls" && /* @__PURE__ */ r(d, {
259
+ useStore: u,
248
260
  useTouchControlsStore: m,
249
- config: h
261
+ config: g
250
262
  }),
251
- v == "Graphics" && /* @__PURE__ */ r(s, {
252
- useStore: d,
253
- config: h
263
+ y == "Graphics" && /* @__PURE__ */ r(s, {
264
+ useStore: u,
265
+ config: g
254
266
  }),
255
- v == "Audio" && /* @__PURE__ */ r(c, {
256
- useAudioStore: p,
257
- config: h
267
+ y == "Audio" && /* @__PURE__ */ r(c, {
268
+ useAudioStore: f,
269
+ config: g
258
270
  }),
259
- v == "Multiplayer" && /* @__PURE__ */ r(l, {
260
- useStore: d,
261
- config: h
271
+ y == "Multiplayer" && /* @__PURE__ */ r(l, {
272
+ useStore: h,
273
+ config: g
262
274
  }),
263
- v == "Other" && /* @__PURE__ */ r(f, {
264
- useStore: d,
265
- config: h
275
+ y == "Other" && /* @__PURE__ */ r(p, {
276
+ useStore: u,
277
+ config: g
266
278
  })
267
279
  ]
268
280
  })
@@ -286,4 +298,4 @@ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsSt
286
298
  });
287
299
  }
288
300
  //#endregion
289
- export { p as t };
301
+ export { m as t };
@@ -1,2 +1,2 @@
1
- import { t as e } from "./SettingsModal-DQSSeIBg.js";
1
+ import { t as e } from "./SettingsModal-D9ZVzkoS.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t as e } from "./Button-C8R7Qxqb.js";
2
+ import { t as e } from "./Button-sSB4xpOw.js";
3
3
  import { useEffect as t, useState as n } from "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  //#region src/components/User/SignInButton.jsx
@@ -0,0 +1,14 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/components/Games/SocketServerUrlHandler.jsx
3
+ function t({ useStore: t }) {
4
+ return e(() => {
5
+ let e = t.getState()?.setSocketServerUrl, n = new URLSearchParams(window.location.search), r = n.get("socketServerUrl");
6
+ if (r) {
7
+ e(r), n.delete("socketServerUrl");
8
+ let t = window.location.pathname + (n.toString() ? `?${n.toString()}` : "") + window.location.hash;
9
+ window.history.replaceState({}, "", t);
10
+ }
11
+ }, []), null;
12
+ }
13
+ //#endregion
14
+ export { t as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Button-C8R7Qxqb.js";
1
+ import { t as e } from "./Button-sSB4xpOw.js";
2
2
  import { n as t, t as n } from "./useAuthSiteStatus-Cj9IjMj7.js";
3
3
  import { useState as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
@@ -19,7 +19,10 @@ function s({ show: s, setShow: c }) {
19
19
  className: "d-flex align-items-center mb-2",
20
20
  children: [/* @__PURE__ */ a("h5", {
21
21
  className: "mb-0 me-2",
22
- children: ["Main Site Status: ", p(m, h, g)]
22
+ children: ["Main Site Status: ", /* @__PURE__ */ i("span", {
23
+ className: `badge ${m ? "bg-success" : "bg-danger"}`,
24
+ children: p(m, h, g)
25
+ })]
23
26
  }), /* @__PURE__ */ a(e, {
24
27
  variant: "link",
25
28
  size: "sm",
@@ -37,7 +40,10 @@ function s({ show: s, setShow: c }) {
37
40
  className: "d-flex align-items-center mb-2",
38
41
  children: [/* @__PURE__ */ a("h5", {
39
42
  className: "mb-0 me-2",
40
- children: ["Auth Site Status: ", p(v, y, b)]
43
+ children: ["Auth Site Status: ", /* @__PURE__ */ i("span", {
44
+ className: `badge ${v ? "bg-success" : "bg-danger"}`,
45
+ children: p(v, y, b)
46
+ })]
41
47
  }), /* @__PURE__ */ a(e, {
42
48
  variant: "link",
43
49
  size: "sm",
@@ -0,0 +1,14 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/components/Games/ToontownModeHandler.jsx
3
+ function t({ useStore: t }) {
4
+ return e(() => {
5
+ let e = t.getState()?.setToontownMode, n = new URLSearchParams(window.location.search);
6
+ if (n.get("toontownMode")) {
7
+ e(!0), n.delete("toontownMode");
8
+ let t = window.location.pathname + (n.toString() ? `?${n.toString()}` : "") + window.location.hash;
9
+ window.history.replaceState({}, "", t);
10
+ }
11
+ }, []), null;
12
+ }
13
+ //#endregion
14
+ export { t as default };
@@ -1,7 +1,7 @@
1
1
  import { n as e, t } from "./classnames-DCsil9eG.js";
2
- import { t as n } from "./Button-C8R7Qxqb.js";
2
+ import { t as n } from "./Button-sSB4xpOw.js";
3
3
  import { t as r } from "./Link-8nSDV4sI.js";
4
- import { a as i, i as a, n as o, o as s, r as c, t as l } from "./numberWithCommas-DXxghuXP.js";
4
+ import { a as i, i as a, n as o, o as s, r as c, t as l } from "./numberWithCommas-DSRplpBy.js";
5
5
  import { useEffect as u, useMemo as ee, useState as d } from "react";
6
6
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
7
  import h from "swr";
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { t as e } from "./ViewUserModal-CrGeXxWG.js";
2
+ import { t as e } from "./ViewUserModal-C5gjfuJ5.js";
3
3
  export { e as default };
package/dist/index.js CHANGED
@@ -1,17 +1,20 @@
1
1
  import e from "./ReturnToLauncherButton.js";
2
2
  import t from "./SignInButton.js";
3
- import n from "./ArticlesAd.js";
4
- import { t as r } from "./Ad-DW52TMZ4.js";
5
- import { t as i } from "./ViewUserModal-CrGeXxWG.js";
6
- import { t as a } from "./GameScoreboard-pTQKozrD.js";
7
- import o from "./GlobalHead.js";
8
- import s from "./GlobalBody.js";
9
- import { t as c } from "./SettingsModal-DQSSeIBg.js";
10
- import l from "./CreditsModal.js";
11
- import u from "./DarkModeHandler.js";
12
- import d from "./useUserFriends.js";
13
- import f from "./FriendsList.js";
14
- import p from "./useUserDetails.js";
15
- import m from "./useUserToken.js";
16
- import h from "./useFullscreen.js";
17
- export { r as Ad, n as ArticlesAd, l as CreditsModal, u as DarkModeHandler, f as FriendsList, a as GameScoreboard, s as GlobalBody, o as GlobalHead, e as ReturnToLauncherButton, c as SettingsModal, t as SignInButton, i as ViewUserModal, h as useFullscreen, p as useUserDetails, d as useUserFriends, m as useUserToken };
3
+ import n from "./useUserDetails.js";
4
+ import r from "./useUserToken.js";
5
+ import { t as i } from "./ViewUserModal-C5gjfuJ5.js";
6
+ import { t as a } from "./Ad-CFuDgQYL.js";
7
+ import o from "./SessionButton.js";
8
+ import s from "./ArticlesAd.js";
9
+ import { t as c } from "./GameScoreboard-9GYlLx72.js";
10
+ import l from "./GlobalHead.js";
11
+ import u from "./GlobalBody.js";
12
+ import { t as d } from "./SettingsModal-D9ZVzkoS.js";
13
+ import f from "./CreditsModal.js";
14
+ import p from "./DarkModeHandler.js";
15
+ import m from "./ToontownModeHandler.js";
16
+ import h from "./SocketServerUrlHandler.js";
17
+ import g from "./useUserFriends.js";
18
+ import _ from "./FriendsList.js";
19
+ import v from "./useFullscreen.js";
20
+ export { a as Ad, s as ArticlesAd, f as CreditsModal, p as DarkModeHandler, _ as FriendsList, c as GameScoreboard, u as GlobalBody, l as GlobalHead, e as ReturnToLauncherButton, o as SessionButton, d as SettingsModal, t as SignInButton, h as SocketServerUrlHandler, m as ToontownModeHandler, i as ViewUserModal, v as useFullscreen, n as useUserDetails, g as useUserFriends, r as useUserToken };
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.27",
4
+ "version": "1.0.29",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"
@@ -22,12 +22,15 @@
22
22
  "./GameScoreboard": "./dist/GameScoreboard.js",
23
23
  "./ReturnToLauncherButton": "./dist/ReturnToLauncherButton.js",
24
24
  "./SignInButton": "./dist/SignInButton.js",
25
+ "./SessionButton": "./dist/SessionButton.js",
25
26
  "./GlobalHead": "./dist/GlobalHead.js",
26
27
  "./GlobalBody": "./dist/GlobalBody.js",
27
28
  "./ViewUserModal": "./dist/ViewUserModal.js",
28
29
  "./SettingsModal": "./dist/SettingsModal.js",
29
30
  "./CreditsModal": "./dist/CreditsModal.js",
30
31
  "./DarkModeHandler": "./dist/DarkModeHandler.js",
32
+ "./ToontownModeHandler": "./dist/ToontownModeHandler.js",
33
+ "./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
31
34
  "./FriendsList": "./dist/FriendsList.js",
32
35
  "./useUserDetails": "./dist/useUserDetails.js",
33
36
  "./useUserToken": "./dist/useUserToken.js",
@@ -63,4 +66,4 @@
63
66
  "vite": "^8.0.3"
64
67
  },
65
68
  "dependencies": {}
66
- }
69
+ }