@versini/sassysaint 5.1.7 → 5.2.0

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.
@@ -1,6 +1,44 @@
1
1
  import z, { useSyncExternalStore as Ne, useCallback as O, useEffect as R, useContext as $, useRef as f, useState as I, useLayoutEffect as V, useMemo as ie, useId as Se, useReducer as Ce } from "react";
2
2
  import l from "clsx";
3
3
  import { jsx as c, jsxs as w, Fragment as Ae } from "react/jsx-runtime";
4
+ function le(e, r) {
5
+ window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: r }));
6
+ }
7
+ const re = (e, r) => {
8
+ const t = JSON.stringify(
9
+ typeof r == "function" ? r() : r
10
+ );
11
+ window.localStorage.setItem(e, t), le(e, t);
12
+ }, Ie = (e) => {
13
+ window.localStorage.removeItem(e), le(e, null);
14
+ }, ae = (e) => window.localStorage.getItem(e), Re = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
15
+ function St({
16
+ key: e,
17
+ initialValue: r
18
+ }) {
19
+ const t = Ne(Re, () => ae(e)), a = O(
20
+ (i) => {
21
+ try {
22
+ const s = typeof i == "function" ? i(JSON.parse(t)) : i;
23
+ s == null ? Ie(e) : re(e, s);
24
+ } catch (s) {
25
+ console.warn(s);
26
+ }
27
+ },
28
+ [e, t]
29
+ ), o = O(() => {
30
+ a(r);
31
+ }, [r, a]), n = O(() => {
32
+ a(null);
33
+ }, [a]);
34
+ return R(() => {
35
+ try {
36
+ ae(e) === null && typeof r < "u" && re(e, r);
37
+ } catch (i) {
38
+ console.warn(i);
39
+ }
40
+ }, [e, r]), [t ? JSON.parse(t) : null, a, o, n];
41
+ }
4
42
  const _ = {
5
43
  GET_LOCATION: `query GetLocation($latitude: Float!, $longitude: Float!) {
6
44
  location(latitude: $latitude, longitude: $longitude) {
@@ -52,6 +90,7 @@ const _ = {
52
90
  models
53
91
  plugins
54
92
  engine
93
+ engines
55
94
  }
56
95
  }`,
57
96
  GET_USER_PREFERENCES: `query GetUserPreferences($user: String!) {
@@ -63,7 +102,7 @@ const _ = {
63
102
  }`,
64
103
  SET_USER_PREFERENCES: `mutation SetUserPreferences(
65
104
  $user: String!,
66
- $instructions: String!,
105
+ $instructions: String,
67
106
  $location: String,
68
107
  $engine: String) {
69
108
  setUserPreferences(
@@ -72,73 +111,44 @@ const _ = {
72
111
  location: $location,
73
112
  engine: $engine)
74
113
  }`
75
- }, St = {
114
+ }, Ct = {
76
115
  GET_LOCATION: {
77
116
  schema: _.GET_LOCATION,
78
- method: "location",
79
- data: (e) => ({
80
- latitude: e.latitude,
81
- longitude: e.longitude
82
- })
117
+ method: "location"
83
118
  },
84
119
  GET_CHATS: {
85
120
  schema: _.GET_CHATS,
86
- method: "chats",
87
- data: (e) => ({
88
- userId: e.userId
89
- })
121
+ method: "chats"
90
122
  },
91
123
  GET_CHATS_STATS: {
92
124
  schema: _.GET_CHATS_STATS,
93
- method: "chatsStats",
94
- data: (e) => ({
95
- userId: e.userId
96
- })
125
+ method: "chatsStats"
97
126
  },
98
127
  GET_CHAT: {
99
128
  schema: _.GET_CHAT,
100
- method: "chatById",
101
- data: (e) => ({
102
- id: e.id
103
- })
129
+ method: "chatById"
104
130
  },
105
131
  DELETE_CHAT: {
106
132
  schema: _.DELETE_CHAT,
107
- method: "deleteChat",
108
- data: (e) => ({
109
- id: e.id,
110
- userId: e.userId
111
- })
133
+ method: "deleteChat"
112
134
  },
113
135
  ABOUT: {
114
136
  schema: _.ABOUT,
115
- method: "about",
116
- data: (e) => ({
117
- user: e.user
118
- })
137
+ method: "about"
119
138
  },
120
139
  GET_USER_PREFERENCES: {
121
140
  schema: _.GET_USER_PREFERENCES,
122
- method: "getUserPreferences",
123
- data: (e) => ({
124
- user: e.user
125
- })
141
+ method: "getUserPreferences"
126
142
  },
127
143
  SET_USER_PREFERENCES: {
128
144
  schema: _.SET_USER_PREFERENCES,
129
- method: "setUserPreferences",
130
- data: (e) => ({
131
- user: e.user,
132
- instructions: e.instructions,
133
- location: e.location,
134
- engine: e.engine
135
- })
145
+ method: "setUserPreferences"
136
146
  }
137
- }, le = process.env.PUBLIC_SASSY_API_SERVER_URL, Ie = async ({
147
+ }, se = process.env.PUBLIC_SASSY_API_SERVER_URL, $e = async ({
138
148
  query: e,
139
149
  data: r,
140
150
  headers: t = {}
141
- }) => await fetch(`${le}/graphql`, {
151
+ }) => await fetch(`${se}/graphql`, {
142
152
  method: "POST",
143
153
  credentials: "include",
144
154
  headers: {
@@ -150,14 +160,14 @@ const _ = {
150
160
  query: e,
151
161
  variables: r
152
162
  })
153
- }), Ct = async ({
163
+ }), At = async ({
154
164
  accessToken: e,
155
165
  type: r,
156
166
  params: t = {}
157
167
  }) => {
158
168
  const a = r != null && r.data ? r.data(t) : t;
159
169
  try {
160
- const o = `Bearer ${e}`, n = await Ie({
170
+ const o = `Bearer ${e}`, n = await $e({
161
171
  headers: {
162
172
  authorization: o
163
173
  },
@@ -175,14 +185,14 @@ const _ = {
175
185
  } catch (o) {
176
186
  return console.error(o), { status: 500, data: [] };
177
187
  }
178
- }, At = async ({
188
+ }, It = async ({
179
189
  accessToken: e,
180
190
  name: r,
181
191
  data: t,
182
192
  method: a = "POST"
183
193
  }) => {
184
194
  const o = `Bearer ${e}`;
185
- return await fetch(`${le}/api/${r}`, {
195
+ return await fetch(`${se}/api/${r}`, {
186
196
  method: a,
187
197
  credentials: "include",
188
198
  headers: {
@@ -192,44 +202,6 @@ const _ = {
192
202
  body: JSON.stringify(t)
193
203
  });
194
204
  };
195
- function se(e, r) {
196
- window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: r }));
197
- }
198
- const re = (e, r) => {
199
- const t = JSON.stringify(
200
- typeof r == "function" ? r() : r
201
- );
202
- window.localStorage.setItem(e, t), se(e, t);
203
- }, Re = (e) => {
204
- window.localStorage.removeItem(e), se(e, null);
205
- }, ae = (e) => window.localStorage.getItem(e), $e = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
206
- function It({
207
- key: e,
208
- initialValue: r
209
- }) {
210
- const t = Ne($e, () => ae(e)), a = O(
211
- (i) => {
212
- try {
213
- const s = typeof i == "function" ? i(JSON.parse(t)) : i;
214
- s == null ? Re(e) : re(e, s);
215
- } catch (s) {
216
- console.warn(s);
217
- }
218
- },
219
- [e, t]
220
- ), o = O(() => {
221
- a(r);
222
- }, [r, a]), n = O(() => {
223
- a(null);
224
- }, [a]);
225
- return R(() => {
226
- try {
227
- ae(e) === null && typeof r < "u" && re(e, r);
228
- } catch (i) {
229
- console.warn(i);
230
- }
231
- }, [e, r]), [t ? JSON.parse(t) : null, a, o, n];
232
- }
233
205
  /*!
234
206
  @versini/ui-table v1.0.11
235
207
  © 2024 gizmette.com
@@ -1434,8 +1406,8 @@ const pt = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
1434
1406
  );
1435
1407
  wt.displayName = "TextArea";
1436
1408
  export {
1437
- It as E,
1438
- St as SERVICE_TYPES,
1409
+ St as E,
1410
+ Ct as SERVICE_TYPES,
1439
1411
  Ht as be,
1440
1412
  Rt as ce,
1441
1413
  M as f,
@@ -1443,8 +1415,8 @@ export {
1443
1415
  Bt as he,
1444
1416
  et as ie,
1445
1417
  Lt as me,
1446
- At as restCall,
1447
- Ct as serviceCall,
1418
+ It as restCall,
1419
+ At as serviceCall,
1448
1420
  Ut as ue,
1449
1421
  wt as we
1450
1422
  };
@@ -2,7 +2,7 @@ import { jsx as i, jsxs as E, Fragment as D } from "react/jsx-runtime";
2
2
  import y from "clsx";
3
3
  import * as c from "react";
4
4
  import { useRef as A, useReducer as M, useEffect as _, useId as R } from "react";
5
- import { useMergeRefs as x, FloatingPortal as F, FloatingOverlay as O, FloatingFocusManager as P, useFloating as S, useClick as k, useDismiss as L, useRole as V, useInteractions as $ } from "@floating-ui/react";
5
+ import { useMergeRefs as x, FloatingPortal as F, FloatingOverlay as O, FloatingFocusManager as P, useFloating as S, useClick as $, useDismiss as k, useRole as L, useInteractions as V } from "@floating-ui/react";
6
6
  const I = "SET_ANNOUNCEMENT", w = "CLEAR_ANNOUNCEMENT", B = {
7
7
  alert: null,
8
8
  alertdialog: null,
@@ -127,12 +127,12 @@ function H({
127
127
  const [o, l] = c.useState(e), [r, a] = c.useState(), [s, f] = c.useState(), u = n ?? o, d = t ?? l, m = S({
128
128
  open: u,
129
129
  onOpenChange: d
130
- }), p = m.context, h = k(p, {
130
+ }), p = m.context, h = $(p, {
131
131
  enabled: n == null
132
- }), v = L(p, {
132
+ }), v = k(p, {
133
133
  outsidePress: !1,
134
134
  outsidePressEvent: "mousedown"
135
- }), N = V(p), b = $([h, v, N]);
135
+ }), N = L(p), b = V([h, v, N]);
136
136
  return c.useMemo(
137
137
  () => ({
138
138
  open: u,
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { SassySaint as a } from "../../chunks/index.DpYYn2Ap.js";
2
+ import { SassySaint as a } from "../../chunks/index.BbfwgIO_.js";
3
3
  export {
4
4
  a as SassySaint
5
5
  };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { SassySaint as r } from "./chunks/index.DpYYn2Ap.js";
1
+ import { SassySaint as r } from "./chunks/index.BbfwgIO_.js";
2
2
  /*!
3
- @sassysaint/client v5.0.2
3
+ @sassysaint/client v5.1.0
4
4
  © 2024 gizmette.com
5
5
  */
6
6
  try {
7
7
  window.__VERSINI_SASSY_GLOBAL__ || (window.__VERSINI_SASSY_GLOBAL__ = {
8
- version: "5.0.2",
9
- buildTime: "10/03/2024 03:50 PM EDT",
8
+ version: "5.1.0",
9
+ buildTime: "10/05/2024 02:51 PM EDT",
10
10
  license: "MIT"
11
11
  });
12
12
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/sassysaint",
3
- "version": "5.1.7",
3
+ "version": "5.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -30,8 +30,8 @@
30
30
  "react-dom": "18.3.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@sassysaint/client": "5.0.2",
34
- "@versini/ui-styles": "1.10.2"
33
+ "@sassysaint/client": "5.1.0",
34
+ "@versini/ui-styles": "1.11.0"
35
35
  },
36
36
  "dependencies": {
37
37
  "@versini/ui-hooks": "4.2.1",
@@ -41,5 +41,5 @@
41
41
  "sideEffects": [
42
42
  "**/*.css"
43
43
  ],
44
- "gitHead": "ed09a78ab051b4f718850bda8f518e951aba883e"
44
+ "gitHead": "98f4ad16feba918d36ddc8f2c9b1f2116f8b6f81"
45
45
  }