@levo-so/react 0.1.34 → 0.1.36

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 (37) hide show
  1. package/dist/{CheckboxWidget-BrVNbP0R.js → CheckboxWidget-3qTjxIlp.js} +1 -1
  2. package/dist/{CollectionFormBuilder-CkD8uVKZ.js → CollectionFormBuilder-CUzpwIva.js} +17 -17
  3. package/dist/{CurrencyWidget-D_q2AYWu.js → CurrencyWidget-DgH4uCpg.js} +1 -1
  4. package/dist/{DateTimeWidget-CsuCisSs.js → DateTimeWidget-C2hLHKU6.js} +1 -1
  5. package/dist/{DefaultFormVariant-rv38sBOZ.js → DefaultFormVariant-Cm9i2BBn.js} +2 -2
  6. package/dist/{DropdownWidget-CsTQ0Ojo.js → DropdownWidget-B6mRXcTa.js} +1 -1
  7. package/dist/{EmailWidget-Did2OUyB.js → EmailWidget-CBFnvo9z.js} +1 -1
  8. package/dist/{FormCaptcha-C_DxR2za.js → FormCaptcha-btA0HfMx.js} +3 -3
  9. package/dist/{GeocoderWidget-CyzcaWxa.js → GeocoderWidget-DZGXm9Ji.js} +2 -2
  10. package/dist/{MultiGeocoderWidget-DgwiZ330.js → MultiGeocoderWidget-D7ogTcWu.js} +2 -2
  11. package/dist/{MultiTextWidget-Dic46WBU.js → MultiTextWidget-DYxi8PHm.js} +1 -1
  12. package/dist/{PhoneWidget-DKH-Wzgz.js → PhoneWidget-BxaGCfLs.js} +1 -1
  13. package/dist/{RadioWidget-CTgWKCg2.js → RadioWidget-Bkq1Oudi.js} +1 -1
  14. package/dist/{RichTextWidget-C30H7mVF.js → RichTextWidget-Caqhw4GK.js} +1 -1
  15. package/dist/{StepsFormVariant-myT97AwJ.js → StepsFormVariant-D-m93LMv.js} +2 -2
  16. package/dist/{SwitchWidget-BS-rmHiq.js → SwitchWidget-BpAzgVui.js} +1 -1
  17. package/dist/{TextWidget-aNB-0vc-.js → TextWidget-CHkFlxmT.js} +1 -1
  18. package/dist/{TextareaWidget-CEH-97Oj.js → TextareaWidget-B0htlijX.js} +1 -1
  19. package/dist/{ToggleCheckboxWidget-C0buyS29.js → ToggleCheckboxWidget-DLrS6ax4.js} +1 -1
  20. package/dist/{URLWidget-DrZlRAD7.js → URLWidget-CnWKNlOF.js} +2 -2
  21. package/dist/{UploadWidget-Bw7urh-7.js → UploadWidget-DSvWOBuR.js} +1 -1
  22. package/dist/audience/components/page.d.ts +3 -4
  23. package/dist/audience/components/page.d.ts.map +1 -1
  24. package/dist/audience/hooks/useDownloadSpeed.d.ts.map +1 -1
  25. package/dist/audience/hooks/usePerformanceMetrics.d.ts +8 -11
  26. package/dist/audience/hooks/usePerformanceMetrics.d.ts.map +1 -1
  27. package/dist/audience/hooks/useTrackClicks.d.ts.map +1 -1
  28. package/dist/audience/index.js +1 -1
  29. package/dist/collection/index.js +1 -1
  30. package/dist/index.js +2 -2
  31. package/dist/membership/index.js +70 -69
  32. package/dist/page-C1-z2EsC.js +574 -0
  33. package/dist/providers/LevoProvider.d.ts +4 -19
  34. package/dist/providers/LevoProvider.d.ts.map +1 -1
  35. package/dist/providers/index.js +8 -164
  36. package/package.json +2 -2
  37. package/dist/page-BaAkHGtG.js +0 -562
@@ -1,169 +1,13 @@
1
1
  "use client";
2
- var g = Object.defineProperty;
3
- var m = (t, e, s) => e in t ? g(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
4
- var o = (t, e, s) => m(t, typeof e != "symbol" ? e + "" : e, s);
5
- import { j as d } from "../jsx-runtime-B6kdoens.js";
6
- import v from "wretch";
7
- import { createContext as w, useState as c, useContext as p } from "react";
8
- var u = class {
9
- constructor(t) {
10
- o(this, "client");
11
- this.client = t;
12
- }
13
- }, y = class {
14
- constructor(t = {}) {
15
- o(this, "logApiUrl", "https://public-api.levo.so");
16
- o(this, "logs", []);
17
- o(this, "activeFlush", Promise.resolve());
18
- o(this, "nextFlush", setTimeout(() => {
19
- }, 0));
20
- o(this, "lastFlush", /* @__PURE__ */ new Date());
21
- o(this, "sendLogs", async (t) => {
22
- const e = `${this.logApiUrl}/v1/apm/logs/json`, s = () => v().url(e).post(t).res().catch((n) => console.error(n));
23
- try {
24
- if (typeof fetch > "u")
25
- throw new Error("fetch is not defined");
26
- if (typeof window < "u" && navigator.sendBeacon)
27
- try {
28
- if (!navigator.sendBeacon.bind(navigator)(e, JSON.stringify(t)))
29
- return s();
30
- } catch {
31
- return s();
32
- }
33
- else
34
- return s();
35
- } catch (n) {
36
- console.warn(`Failed to send logs to server: ${n}`), this.logs = [...this.logs, ...t];
37
- }
38
- });
39
- o(this, "ingest", (t) => {
40
- if (!this.logApiUrl) return;
41
- const e = Array.isArray(t) ? t : [t];
42
- this.logs.push(e), this.logs.length >= 50 || this.lastFlush.getTime() < Date.now() - 1500 ? (clearTimeout(this.nextFlush), this.activeFlush = this.flush()) : (clearTimeout(this.nextFlush), this.nextFlush = setTimeout(() => {
43
- this.activeFlush = this.flush();
44
- }, 1500));
45
- });
46
- o(this, "flush", async () => {
47
- const t = this.logs.splice(0, this.logs.length);
48
- if (clearTimeout(this.nextFlush), await this.activeFlush, t.length === 0) {
49
- this.lastFlush = /* @__PURE__ */ new Date();
50
- return;
51
- }
52
- try {
53
- await this.sendLogs(t);
54
- } catch (e) {
55
- console.log("error sending logs", e);
56
- } finally {
57
- this.lastFlush = /* @__PURE__ */ new Date();
58
- }
59
- });
60
- t != null && t.logApiUrl && (this.logApiUrl = t == null ? void 0 : t.logApiUrl);
61
- }
62
- }, h = typeof window < "u", x = (t) => {
63
- switch (t) {
64
- case 0:
65
- return "log";
66
- case 1:
67
- return "info";
68
- case 2:
69
- return "warn";
70
- case 3:
71
- return "error";
72
- default:
73
- return "log";
74
- }
75
- }, F = class extends u {
76
- constructor(e, s = {}, n = {}) {
77
- super(e);
78
- o(this, "logLevel", 0);
79
- o(this, "enableRemote", !1);
80
- o(this, "batch");
81
- o(this, "context");
82
- o(this, "debug", (...e) => {
83
- this.log(0, e);
84
- });
85
- o(this, "info", (...e) => {
86
- this.log(1, e);
87
- });
88
- o(this, "warn", (...e) => {
89
- this.log(2, e);
90
- });
91
- o(this, "error", (...e) => {
92
- this.log(3, e);
93
- });
94
- o(this, "log", (e, s) => {
95
- const n = Array.isArray(s) ? s : [s];
96
- if (e < this.logLevel)
97
- return;
98
- if (this.enableRemote && e === 3) {
99
- const { content: i = {}, message: l } = this.format(n);
100
- if (l) {
101
- const a = {
102
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
103
- level: "error",
104
- workspace: this.client.workspace,
105
- appName: this.client.appName,
106
- isBrowser: h,
107
- ...this.context,
108
- message: l,
109
- content: i
110
- };
111
- h && (a.hostname = window.location.hostname, a.pathname = window.location.pathname, a.url = window.location.href, a.page_title = window.document.title, a.userAgent = window.navigator.userAgent), this.batch.ingest(a);
112
- }
113
- }
114
- const r = x(e);
115
- console[r](...n);
116
- });
117
- this.batch = new y(s), this.context = n, this.logLevel = (s == null ? void 0 : s.level) ?? (this.client.NODE_ENV !== "development" ? 1 : 0), this.enableRemote = (s == null ? void 0 : s.enableRemote) ?? this.client.NODE_ENV !== "development";
118
- }
119
- format(e) {
120
- let s = "";
121
- const n = e.map((r) => {
122
- let i = "";
123
- const l = !s;
124
- return typeof r == "string" ? (i = r, l && (s = r)) : r instanceof Error ? (i = {
125
- message: r.message,
126
- name: r.name,
127
- stack: r.stack
128
- }, l && (s = r.message)) : typeof r == "object" ? i = r : (i = String(r), l && (s = String(r))), i;
129
- }).filter(Boolean);
130
- return !s && n.length > 0 && (s = "Default message (Check content for details)"), (n == null ? void 0 : n.length) === 1 && n[0] === s ? { message: s, content: {} } : {
131
- message: s,
132
- content: n
133
- };
134
- }
135
- }, L = class extends u {
136
- constructor() {
137
- super(...arguments);
138
- o(this, "mediaBulkUpload", (e, s = {}) => this.client.fetch.url("/v1/assets/media/bulk").options(s).post(e).json());
139
- o(this, "getAllMedia", async (e = {}) => await this.client.fetch.url("/v1/assets/media/query").post(e).json());
140
- }
141
- };
142
- const f = w(null), N = ({
143
- children: t,
144
- client: e,
145
- ...s
146
- }) => {
147
- const [n] = c(new F(e)), [r] = c(new L(e));
148
- return /* @__PURE__ */ d.jsx(
149
- f.Provider,
150
- {
151
- value: {
152
- client: e,
153
- media: r,
154
- logger: n,
155
- ...s
156
- },
157
- children: t
158
- }
159
- );
160
- }, j = () => {
161
- const t = p(f);
162
- if (!t)
2
+ import { j as r } from "../jsx-runtime-B6kdoens.js";
3
+ import { createContext as n, useContext as s } from "react";
4
+ const o = n(null), v = ({ children: e, client: t }) => /* @__PURE__ */ r.jsx(o.Provider, { value: t, children: e }), x = () => {
5
+ const e = s(o);
6
+ if (!e)
163
7
  throw new Error("useLevo must be used within LevoProvider");
164
- return t;
8
+ return e;
165
9
  };
166
10
  export {
167
- N as LevoProvider,
168
- j as useLevo
11
+ v as LevoProvider,
12
+ x as useLevo
169
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/react",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo suite for React based applications",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  "peerDependencies": {
17
17
  "react": ">=18",
18
18
  "react-dom": ">=18",
19
- "@levo-so/core": "0.1.34"
19
+ "@levo-so/core": "0.1.36"
20
20
  },
21
21
  "dependencies": {
22
22
  "@radix-ui/react-checkbox": "1.1.1",