@articles-media/articles-dev-box 1.0.28 → 1.0.30

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
@@ -65,6 +67,10 @@ npm run dev
65
67
  - Hook for getting the details of the current user if a valid user token is found.
66
68
  - useFullscreen
67
69
  - Hook for going fullscreen on the body or provided element
70
+ - typicalZustandStoreExcludes
71
+ - Array of strings that every game published by Articles Media would want to normally exclude from persisting in base game store.
72
+ - typicalZustandStoreStateSlice
73
+ - Slice of zustand states that every game normally uses
68
74
 
69
75
  # Roadmap
70
76
  ⏹️ Remove Bootstrap reliance
@@ -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-CM9gjtT8.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,18 +1,18 @@
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";
5
5
  //#region src/components/Games/Settings/GraphicsTab.jsx
6
- function s({ useStore: t }) {
7
- let a = t((e) => e?.darkMode), o = t((e) => e?.setDarkMode), s = t((e) => e?.graphicsQuality), c = t((e) => e?.setGraphicsQuality), l = t((e) => e?.landingAnimation), u = t((e) => e?.setLandingAnimation);
6
+ function s({ useStore: t, config: a }) {
7
+ let o = t((e) => e?.darkMode), s = t((e) => e?.setDarkMode), c = t((e) => e?.graphicsQuality), l = t((e) => e?.setGraphicsQuality), u = t((e) => e?.landingAnimation), d = t((e) => e?.setLandingAnimation);
8
8
  return /* @__PURE__ */ i(n, { children: [
9
9
  /* @__PURE__ */ r("div", { children: "Dark Mode" }),
10
10
  /* @__PURE__ */ r("div", {
11
11
  className: "mb-3",
12
12
  children: [!1, !0].map((t, n) => /* @__PURE__ */ r(e, {
13
- active: a === t,
13
+ active: o === t,
14
14
  onClick: () => {
15
- o(t);
15
+ s(t);
16
16
  },
17
17
  children: t ? "On" : "Off"
18
18
  }, n))
@@ -25,9 +25,9 @@ function s({ useStore: t }) {
25
25
  "Medium",
26
26
  "High"
27
27
  ].map((t) => /* @__PURE__ */ r(e, {
28
- active: s === t,
28
+ active: c === t,
29
29
  onClick: () => {
30
- c(t);
30
+ l(t);
31
31
  },
32
32
  children: t
33
33
  }, t))
@@ -36,19 +36,20 @@ function s({ useStore: t }) {
36
36
  /* @__PURE__ */ i("div", {
37
37
  className: "mb-3",
38
38
  children: [/* @__PURE__ */ r(e, {
39
- active: l === !1,
39
+ active: u === !1,
40
40
  onClick: () => {
41
- u(!1);
41
+ d(!1);
42
42
  },
43
43
  children: "Disabled"
44
44
  }), /* @__PURE__ */ r(e, {
45
- active: l === !0,
45
+ active: u === !0,
46
46
  onClick: () => {
47
- u(!0);
47
+ d(!0);
48
48
  },
49
49
  children: "Enabled"
50
50
  })]
51
- })
51
+ }),
52
+ a?.tabs?.Graphics?.children
52
53
  ] });
53
54
  }
54
55
  //#endregion
@@ -95,55 +96,58 @@ function c({ useAudioStore: t, config: o }) {
95
96
  }
96
97
  //#endregion
97
98
  //#region src/components/Games/Settings/MultiplayerTab.jsx
98
- function l({ useStore: t, config: n }) {
99
- let o = t((e) => e.serverUrl), s = t((e) => e.setServerUrl), c = t((e) => e.connected), l = t((e) => e.connectSocket), u = t((e) => e.disconnectSocket);
100
- return /* @__PURE__ */ i("div", {
99
+ function l({ useStore: e, config: t }) {
100
+ return /* @__PURE__ */ r("div", {
101
101
  className: "",
102
- children: [
103
- /* @__PURE__ */ i(a.Label, {
104
- className: "mb-0",
105
- children: [/* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
106
- className: `badge ${c ? "bg-success" : "bg-danger"}`,
107
- children: c ? "Online" : "Offline"
108
- })] }), "Socket Server Host"]
109
- }),
110
- /* @__PURE__ */ r(a.Control, {
111
- type: "text",
112
- value: o,
113
- onChange: (e) => s(e.target.value)
114
- }),
115
- /* @__PURE__ */ r(a.Label, {
116
- className: "mb-0",
117
- children: "Edit this to connect to a different multiplayer host!"
118
- }),
119
- /* @__PURE__ */ r("div", {
120
- className: "mt-3",
121
- children: c ? /* @__PURE__ */ r(e, {
122
- className: "",
123
- onClick: () => {
124
- u();
125
- },
126
- children: "Disconnect"
127
- }) : /* @__PURE__ */ r(e, {
128
- className: "",
129
- onClick: () => {
130
- l();
131
- },
132
- children: "Connect"
133
- })
134
- })
135
- ]
102
+ children: e && /* @__PURE__ */ r(u, { useStore: e })
136
103
  });
137
104
  }
105
+ function u({ useStore: t }) {
106
+ 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);
107
+ return /* @__PURE__ */ i("div", { children: [
108
+ /* @__PURE__ */ i(a.Label, {
109
+ className: "mb-0",
110
+ children: [/* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
111
+ className: `badge ${s ? "bg-success" : "bg-danger"}`,
112
+ children: s ? "Online" : "Offline"
113
+ })] }), "Socket Server Host"]
114
+ }),
115
+ /* @__PURE__ */ r(a.Control, {
116
+ type: "text",
117
+ value: n,
118
+ onChange: (e) => o(e.target.value)
119
+ }),
120
+ /* @__PURE__ */ r(a.Label, {
121
+ className: "mb-0",
122
+ children: "Edit this to connect to a different multiplayer host!"
123
+ }),
124
+ /* @__PURE__ */ r("div", {
125
+ className: "mt-3",
126
+ children: s ? /* @__PURE__ */ r(e, {
127
+ className: "",
128
+ onClick: () => {
129
+ l();
130
+ },
131
+ children: "Disconnect"
132
+ }) : /* @__PURE__ */ r(e, {
133
+ className: "",
134
+ onClick: () => {
135
+ c();
136
+ },
137
+ children: "Connect"
138
+ })
139
+ })
140
+ ] });
141
+ }
138
142
  //#endregion
139
143
  //#region src/components/Games/Settings/ControlsTab.jsx
140
- function u({ useTouchControlsStore: e }) {
144
+ function d({ useTouchControlsStore: e }) {
141
145
  return /* @__PURE__ */ r("div", {
142
146
  className: "",
143
- children: e && /* @__PURE__ */ r(d, { useTouchControlsStore: e })
147
+ children: e && /* @__PURE__ */ r(f, { useTouchControlsStore: e })
144
148
  });
145
149
  }
146
- function d({ useTouchControlsStore: t }) {
150
+ function f({ useTouchControlsStore: t }) {
147
151
  let n = t((e) => e?.enabled), a = t((e) => e?.setEnabled);
148
152
  return /* @__PURE__ */ i("div", {
149
153
  className: "mb-3",
@@ -168,7 +172,7 @@ function d({ useTouchControlsStore: t }) {
168
172
  }
169
173
  //#endregion
170
174
  //#region src/components/Games/Settings/OtherTab.jsx
171
- function f({ useStore: t, config: a, children: o }) {
175
+ function p({ useStore: t, config: a, children: o }) {
172
176
  let s = t((e) => e?.debug), c = t((e) => e?.setDebug), l = t((e) => e?.toontownMode), u = t((e) => e?.setToontownMode);
173
177
  return /* @__PURE__ */ i(n, { children: [
174
178
  /* @__PURE__ */ r("div", { children: "Debug Mode" }),
@@ -210,11 +214,11 @@ function f({ useStore: t, config: a, children: o }) {
210
214
  }
211
215
  //#endregion
212
216
  //#region src/components/Games/Settings/SettingsModal.jsx
213
- function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsStore: m, useSocketStore: h, config: g }) {
217
+ function m({ show: n, setShow: a, store: u, useAudioStore: f, useTouchControlsStore: m, useSocketStore: h, config: g }) {
214
218
  let [_, v] = t(!1), [y, b] = t(localStorage.getItem("articles_settings_tab") || "Graphics"), x = (e) => {
215
219
  b(e), localStorage.setItem("articles_settings_tab", e);
216
220
  };
217
- return d((e) => e.darkMode), d((e) => e.setDarkMode), d((e) => e.arcadeMode), d((e) => e.setArcadeMode), /* @__PURE__ */ i(o, {
221
+ return u((e) => e.darkMode), u((e) => e.setDarkMode), u((e) => e.arcadeMode), u((e) => e.setArcadeMode), /* @__PURE__ */ i(o, {
218
222
  className: "articles-modal",
219
223
  size: "md",
220
224
  show: n,
@@ -252,25 +256,25 @@ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsSt
252
256
  /* @__PURE__ */ i("div", {
253
257
  className: "p-3",
254
258
  children: [
255
- y == "Controls" && /* @__PURE__ */ r(u, {
256
- useStore: d,
259
+ y == "Controls" && /* @__PURE__ */ r(d, {
260
+ useStore: u,
257
261
  useTouchControlsStore: m,
258
262
  config: g
259
263
  }),
260
264
  y == "Graphics" && /* @__PURE__ */ r(s, {
261
- useStore: d,
265
+ useStore: u,
262
266
  config: g
263
267
  }),
264
268
  y == "Audio" && /* @__PURE__ */ r(c, {
265
- useAudioStore: p,
269
+ useAudioStore: f,
266
270
  config: g
267
271
  }),
268
272
  y == "Multiplayer" && /* @__PURE__ */ r(l, {
269
273
  useStore: h,
270
274
  config: g
271
275
  }),
272
- y == "Other" && /* @__PURE__ */ r(f, {
273
- useStore: d,
276
+ y == "Other" && /* @__PURE__ */ r(p, {
277
+ useStore: u,
274
278
  config: g
275
279
  })
276
280
  ]
@@ -295,4 +299,4 @@ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsSt
295
299
  });
296
300
  }
297
301
  //#endregion
298
- export { p as t };
302
+ export { m as t };
@@ -1,2 +1,2 @@
1
- import { t as e } from "./SettingsModal-DZmAGhAO.js";
1
+ import { t as e } from "./SettingsModal-gPPyBi4S.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
@@ -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";
@@ -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,19 +1,22 @@
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-DZmAGhAO.js";
10
- import l from "./CreditsModal.js";
11
- import u from "./DarkModeHandler.js";
12
- import d from "./ToontownModeHandler.js";
13
- import f from "./SocketServerUrlHandler.js";
14
- import p from "./useUserFriends.js";
15
- import m from "./FriendsList.js";
16
- import h from "./useUserDetails.js";
17
- import g from "./useUserToken.js";
18
- import _ from "./useFullscreen.js";
19
- export { r as Ad, n as ArticlesAd, l as CreditsModal, u as DarkModeHandler, m as FriendsList, a as GameScoreboard, s as GlobalBody, o as GlobalHead, e as ReturnToLauncherButton, c as SettingsModal, t as SignInButton, f as SocketServerUrlHandler, d as ToontownModeHandler, i as ViewUserModal, _ as useFullscreen, h as useUserDetails, p as useUserFriends, g 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-gPPyBi4S.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
+ import y from "./typicalZustandStoreExcludes.js";
21
+ import b from "./typicalZustandStoreStateSlice.js";
22
+ 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, y as typicalZustandStoreExcludes, b as typicalZustandStoreStateSlice, v as useFullscreen, n as useUserDetails, g as useUserFriends, r as useUserToken };
@@ -0,0 +1,13 @@
1
+ //#region src/constants/typicalZustandStoreExcludes.js
2
+ var e = [
3
+ "_hasHydrated",
4
+ "showSettingsModal",
5
+ "showInfoModal",
6
+ "showCreditsModal",
7
+ "showGameOverModal",
8
+ "showMenu",
9
+ "lobbyDetails",
10
+ "sceneKey"
11
+ ];
12
+ //#endregion
13
+ export { e as default };
@@ -0,0 +1,72 @@
1
+ //#region src/constants/typicalZustandStoreStateSlice.js
2
+ var e = (e, t, n) => ({
3
+ _hasHydrated: !1,
4
+ setHasHydrated: (t) => {
5
+ e({ _hasHydrated: t });
6
+ },
7
+ darkMode: null,
8
+ toggleDarkMode: () => e({ darkMode: !t().darkMode }),
9
+ setDarkMode: (t) => {
10
+ e((e) => ({ darkMode: t }));
11
+ },
12
+ nickname: n(),
13
+ setNickname: (t) => {
14
+ e((e) => ({ nickname: t }));
15
+ },
16
+ randomNickname: () => {
17
+ let t = n();
18
+ e((e) => ({ nickname: t }));
19
+ },
20
+ nicknameKeyboard: !1,
21
+ setNicknameKeyboard: (t) => {
22
+ e((e) => ({ nicknameKeyboard: t }));
23
+ },
24
+ debug: !1,
25
+ setDebug: (t) => {
26
+ e((e) => ({ debug: t }));
27
+ },
28
+ sidebar: !0,
29
+ toggleSidebar: () => {
30
+ e((e) => ({ sidebar: !e.sidebar }));
31
+ },
32
+ setSidebar: (t) => {
33
+ e((e) => ({ sidebar: t }));
34
+ },
35
+ showMenu: !1,
36
+ setShowMenu: (t) => e({ showMenu: t }),
37
+ showSettingsModal: !1,
38
+ setShowSettingsModal: (t) => {
39
+ e((e) => ({ showSettingsModal: t }));
40
+ },
41
+ showInfoModal: !1,
42
+ setShowInfoModal: (t) => {
43
+ e((e) => ({ showInfoModal: t }));
44
+ },
45
+ showCreditsModal: !1,
46
+ setShowCreditsModal: (t) => {
47
+ e((e) => ({ showCreditsModal: t }));
48
+ },
49
+ graphicsQuality: "High",
50
+ setGraphicsQuality: (t) => e({ graphicsQuality: t }),
51
+ lobbyDetails: {
52
+ players: [],
53
+ games: []
54
+ },
55
+ setLobbyDetails: (t) => e({ lobbyDetails: t }),
56
+ landingAnimation: !0,
57
+ setLandingAnimation: (t) => e({ landingAnimation: t }),
58
+ toggleLandingAnimation: () => e({ landingAnimation: !t().landingAnimation }),
59
+ toontownMode: !1,
60
+ toggleToontownMode: () => {
61
+ e((e) => ({ toontownMode: !e.toontownMode }));
62
+ },
63
+ setToontownMode: (t) => {
64
+ e((e) => ({ toontownMode: t }));
65
+ },
66
+ showGameOverModal: !1,
67
+ setShowGameOverModal: (t) => {
68
+ e((e) => ({ showGameOverModal: t }));
69
+ }
70
+ });
71
+ //#endregion
72
+ export { e as default };
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.28",
4
+ "version": "1.0.30",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"
@@ -22,6 +22,7 @@
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",
@@ -35,6 +36,8 @@
35
36
  "./useUserToken": "./dist/useUserToken.js",
36
37
  "./useUserFriends": "./dist/useUserFriends.js",
37
38
  "./useFullscreen": "./dist/useFullscreen.js",
39
+ "./typicalZustandStoreExcludes": "./dist/typicalZustandStoreExcludes.js",
40
+ "./typicalZustandStoreStateSlice": "./dist/typicalZustandStoreStateSlice.js",
38
41
  "./dist/style.css": "./dist/articles-dev-box.css",
39
42
  "./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
40
43
  },
@@ -65,4 +68,4 @@
65
68
  "vite": "^8.0.3"
66
69
  },
67
70
  "dependencies": {}
68
- }
71
+ }