@levo-so/react 0.1.35 → 0.1.37

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 (86) hide show
  1. package/dist/{CheckboxWidget-BrVNbP0R.js → CheckboxWidget-BR6g2qCr.js} +1 -1
  2. package/dist/{CollectionFormBuilder-CkD8uVKZ.js → CollectionFormBuilder-KNHR7ngy.js} +18 -18
  3. package/dist/{CurrencyWidget-D_q2AYWu.js → CurrencyWidget-XHAkyPjV.js} +1 -1
  4. package/dist/{DateTimeWidget-CsuCisSs.js → DateTimeWidget-UaUunQAK.js} +1 -1
  5. package/dist/{DefaultFormVariant-rv38sBOZ.js → DefaultFormVariant-C8hqkuxx.js} +3 -3
  6. package/dist/{DropdownWidget-CsTQ0Ojo.js → DropdownWidget-DvObQQMp.js} +1 -1
  7. package/dist/{EmailWidget-Did2OUyB.js → EmailWidget-7L0S6tat.js} +2 -2
  8. package/dist/{FormCaptcha-C_DxR2za.js → FormCaptcha-CgYoGiya.js} +3 -3
  9. package/dist/{GeocoderWidget-CyzcaWxa.js → GeocoderWidget-DfghAiuD.js} +3 -3
  10. package/dist/{MultiGeocoderWidget-DgwiZ330.js → MultiGeocoderWidget-CqwjH855.js} +3 -3
  11. package/dist/{MultiTextWidget-Dic46WBU.js → MultiTextWidget-BMp9xdSv.js} +1 -1
  12. package/dist/{PhoneWidget-DKH-Wzgz.js → PhoneWidget-DFP4giY9.js} +1 -1
  13. package/dist/{RadioWidget-CTgWKCg2.js → RadioWidget-DMWMo2Mj.js} +2 -2
  14. package/dist/{RichTextWidget-C30H7mVF.js → RichTextWidget-DOCSDDib.js} +2 -2
  15. package/dist/{Spinner-BcBoT-J5.js → Spinner-B4CjY8aw.js} +20 -19
  16. package/dist/{StepsFormVariant-myT97AwJ.js → StepsFormVariant-CUFLCpGE.js} +3 -3
  17. package/dist/{SwitchWidget-BS-rmHiq.js → SwitchWidget-BjpxXOcZ.js} +1 -1
  18. package/dist/{TextWidget-aNB-0vc-.js → TextWidget-Cgk_TFqD.js} +1 -1
  19. package/dist/{TextareaWidget-CEH-97Oj.js → TextareaWidget-DGU_Xhrx.js} +1 -1
  20. package/dist/{ToggleCheckboxWidget-C0buyS29.js → ToggleCheckboxWidget-bhmeasG_.js} +1 -1
  21. package/dist/{URLWidget-DrZlRAD7.js → URLWidget-B20QysNc.js} +2 -2
  22. package/dist/{UploadWidget-Bw7urh-7.js → UploadWidget-SQ1MLpbO.js} +2 -2
  23. package/dist/audience/components/block.d.ts.map +1 -1
  24. package/dist/audience/components/component.d.ts +2 -2
  25. package/dist/audience/components/component.d.ts.map +1 -1
  26. package/dist/audience/components/page.d.ts +3 -4
  27. package/dist/audience/components/page.d.ts.map +1 -1
  28. package/dist/audience/hooks/useBounce.d.ts +4 -0
  29. package/dist/audience/hooks/useBounce.d.ts.map +1 -0
  30. package/dist/audience/hooks/useCurrentTab.d.ts.map +1 -1
  31. package/dist/audience/hooks/useIdentifyAudience.d.ts +7 -0
  32. package/dist/audience/hooks/useIdentifyAudience.d.ts.map +1 -0
  33. package/dist/audience/hooks/useOpenTabs.d.ts.map +1 -1
  34. package/dist/audience/index.js +1 -1
  35. package/dist/collection/index.js +1 -1
  36. package/dist/components/button/buttonVariants.d.ts +1 -1
  37. package/dist/components/button/buttonVariants.d.ts.map +1 -1
  38. package/dist/components/index.js +1 -1
  39. package/dist/index.css +1 -1
  40. package/dist/index.js +3 -3
  41. package/dist/membership/index.js +70 -69
  42. package/dist/page-BVVduzWl.js +626 -0
  43. package/dist/providers/LevoProvider.d.ts +4 -19
  44. package/dist/providers/LevoProvider.d.ts.map +1 -1
  45. package/dist/providers/index.js +8 -164
  46. package/package.json +4 -4
  47. package/dist/Checbox-sq-atGlJ.js.map +0 -1
  48. package/dist/CheckboxWidget-BrVNbP0R.js.map +0 -1
  49. package/dist/CollectionFormBuilder-CkD8uVKZ.js.map +0 -1
  50. package/dist/CurrencyWidget-D_q2AYWu.js.map +0 -1
  51. package/dist/DateTimeWidget-CsuCisSs.js.map +0 -1
  52. package/dist/DefaultFormVariant-rv38sBOZ.js.map +0 -1
  53. package/dist/DropdownWidget-CsTQ0Ojo.js.map +0 -1
  54. package/dist/EmailWidget-Did2OUyB.js.map +0 -1
  55. package/dist/FormCaptcha-C_DxR2za.js.map +0 -1
  56. package/dist/GeocoderWidget-CyzcaWxa.js.map +0 -1
  57. package/dist/Input-Vv7mKQFt.js.map +0 -1
  58. package/dist/MultiGeocoderWidget-DgwiZ330.js.map +0 -1
  59. package/dist/MultiTextWidget-Dic46WBU.js.map +0 -1
  60. package/dist/PhoneWidget-DKH-Wzgz.js.map +0 -1
  61. package/dist/RadioWidget-CTgWKCg2.js.map +0 -1
  62. package/dist/RichTextWidget-C30H7mVF.js.map +0 -1
  63. package/dist/Sonner-t6JVKA0a.js.map +0 -1
  64. package/dist/Spinner-BcBoT-J5.js.map +0 -1
  65. package/dist/StepsFormVariant-myT97AwJ.js.map +0 -1
  66. package/dist/SwitchWidget-BS-rmHiq.js.map +0 -1
  67. package/dist/TextWidget-aNB-0vc-.js.map +0 -1
  68. package/dist/TextareaWidget-CEH-97Oj.js.map +0 -1
  69. package/dist/ToggleCheckboxWidget-C0buyS29.js.map +0 -1
  70. package/dist/Tooltip-DoWyn3Ho.js.map +0 -1
  71. package/dist/URLWidget-DrZlRAD7.js.map +0 -1
  72. package/dist/UploadWidget-Bw7urh-7.js.map +0 -1
  73. package/dist/audience/index.js.map +0 -1
  74. package/dist/byteToSize-BFKZSBu1.js.map +0 -1
  75. package/dist/cn-C9QoOYNG.js.map +0 -1
  76. package/dist/collection/index.js.map +0 -1
  77. package/dist/components/index.js.map +0 -1
  78. package/dist/errorHandler-_34Yv8wA.js.map +0 -1
  79. package/dist/index.js.map +0 -1
  80. package/dist/isEmptyObject-C5s4GzLE.js.map +0 -1
  81. package/dist/jsx-runtime-B6kdoens.js.map +0 -1
  82. package/dist/membership/index.js.map +0 -1
  83. package/dist/page-t8PpNiSB.js +0 -567
  84. package/dist/page-t8PpNiSB.js.map +0 -1
  85. package/dist/providers/index.js.map +0 -1
  86. package/dist/utils/index.js.map +0 -1
@@ -1,146 +1,147 @@
1
1
  "use client";
2
- var P = Object.defineProperty;
3
- var R = (e, t, n) => t in e ? P(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var x = (e, t, n) => R(e, typeof t != "symbol" ? t + "" : t, n);
5
- import { j as h } from "../jsx-runtime-B6kdoens.js";
6
- import j, { useState as L, useEffect as C, useMemo as y, useContext as U, useRef as W, useCallback as _ } from "react";
7
- import { useLevo as k } from "../providers/index.js";
8
- const O = j.createContext({
2
+ var O = Object.defineProperty;
3
+ var R = (e, t, n) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var m = (e, t, n) => R(e, typeof t != "symbol" ? t + "" : t, n);
5
+ import { j as p } from "../jsx-runtime-B6kdoens.js";
6
+ import j, { useState as g, useEffect as x, useMemo as y, useContext as P, useRef as U, useCallback as W } from "react";
7
+ import { useLevo as _ } from "../providers/index.js";
8
+ const L = j.createContext({
9
9
  urls: null,
10
10
  title: "",
11
11
  onSuccess: () => {
12
12
  },
13
13
  onError: () => {
14
14
  }
15
- }), A = ({
15
+ }), b = ({
16
16
  title: e,
17
17
  onSuccess: t,
18
18
  onError: n,
19
- children: c
19
+ children: s
20
20
  }) => {
21
- const { membership: r, client: u } = k(), s = typeof window < "u" ? window.location.href : "", [o, l] = L(null);
22
- C(() => {
23
- r && (r == null || r.getOAuthURL().then((a) => {
24
- l(a);
21
+ const c = _(), i = typeof window < "u" ? window.location.href : "", [o, r] = g(null);
22
+ x(() => {
23
+ var u;
24
+ c.membership && ((u = c.membership) == null || u.getOAuthURL().then((a) => {
25
+ r(a);
25
26
  }).catch(() => {
26
27
  n({
27
28
  code: "SOMETHING_WENT_WRONG",
28
29
  message: "We could not connect with our service for your sign-in."
29
30
  });
30
31
  }));
31
- }, [r]);
32
- const i = y(
32
+ }, []);
33
+ const f = y(
33
34
  () => ({ title: e, urls: o, onSuccess: t, onError: n }),
34
35
  [e, o, t, n]
35
36
  );
36
- return C(() => {
37
- if (o && s) {
38
- const a = {}, p = Object.keys(o);
39
- for (const w of p)
37
+ return x(() => {
38
+ if (o && i) {
39
+ const u = {}, a = Object.keys(o);
40
+ for (const h of a)
40
41
  try {
41
- const f = o[w];
42
- if (f) {
43
- const d = new URL(f), m = d.searchParams;
44
- m.set("redirect_uri", s);
45
- const g = u.getPageContext();
46
- g && m.set("page_context", JSON.stringify(g)), a[w] = d.toString();
42
+ const l = o[h];
43
+ if (l) {
44
+ const w = new URL(l), d = w.searchParams;
45
+ d.set("redirect_uri", i);
46
+ const C = c.pageContext;
47
+ C && d.set("page_context", JSON.stringify(C)), u[h] = w.toString();
47
48
  }
48
49
  } catch {
49
50
  }
50
- l(a);
51
+ r(u);
51
52
  }
52
- }, [s]), /* @__PURE__ */ h.jsx(O.Provider, { value: i, children: c });
53
- }, E = () => U(O), S = ({ url: e, title: t, height: n, width: c }) => {
54
- const r = window.screenX + (window.outerWidth - c) / 2, u = window.screenY + (window.outerHeight - n) / 2.5;
53
+ }, [i]), /* @__PURE__ */ p.jsx(L.Provider, { value: f, children: s });
54
+ }, k = () => P(L), A = ({ url: e, title: t, height: n, width: s }) => {
55
+ const c = window.screenX + (window.outerWidth - s) / 2, i = window.screenY + (window.outerHeight - n) / 2.5;
55
56
  return window.open(
56
57
  e,
57
58
  t,
58
- `width=${c},height=${n},left=${r},top=${u}`
59
+ `width=${s},height=${n},left=${c},top=${i}`
59
60
  );
60
- }, N = ({
61
+ }, E = ({
61
62
  title: e = "",
62
63
  width: t = 500,
63
64
  height: n = 500,
64
- url: c,
65
- children: r,
66
- onCode: u,
67
- onClose: s
65
+ url: s,
66
+ children: c,
67
+ onCode: i,
68
+ onClose: o
68
69
  }) => {
69
- const [o, l] = L(), i = W(), a = () => {
70
- window.clearInterval(i.current);
71
- }, p = () => {
72
- l(
73
- S({
74
- url: c,
70
+ const [r, f] = g(), u = U(), a = () => {
71
+ window.clearInterval(u.current);
72
+ }, h = () => {
73
+ f(
74
+ A({
75
+ url: s,
75
76
  title: e,
76
77
  width: t,
77
78
  height: n
78
79
  })
79
80
  );
80
81
  };
81
- return C(() => (o && (i.current = window.setInterval(() => {
82
+ return x(() => (r && (u.current = window.setInterval(() => {
82
83
  try {
83
- const w = o.location.href, f = new URL(w).searchParams, d = f.get("code");
84
+ const l = r.location.href, w = new URL(l).searchParams, d = w.get("code");
84
85
  if (!d)
85
86
  return;
86
- u(d, f), a(), o.close();
87
+ i(d, w), a(), r.close();
87
88
  } catch {
88
89
  } finally {
89
- (!o || o.closed) && (s(), a());
90
+ (!r || r.closed) && (o(), a());
90
91
  }
91
92
  }, 700)), () => {
92
- o && o.close(), s && s();
93
- }), [o]), /* @__PURE__ */ h.jsx(
93
+ r && r.close(), o && o();
94
+ }), [r]), /* @__PURE__ */ p.jsx(
94
95
  "div",
95
96
  {
96
97
  onClick: () => {
97
- p();
98
+ h();
98
99
  },
99
- children: r
100
+ children: c
100
101
  }
101
102
  );
102
- }, $ = ({
103
+ }, S = ({
103
104
  title: e = "Levo",
104
105
  url: t,
105
106
  children: n,
106
- onSuccess: c,
107
- onError: r,
108
- width: u = 500,
109
- height: s = 700
107
+ onSuccess: s,
108
+ onError: c,
109
+ width: i = 500,
110
+ height: o = 700
110
111
  }) => {
111
- const o = _((l, i) => {
112
- l.toLowerCase() === "success" ? c(i) : r(i);
112
+ const r = W((f, u) => {
113
+ f.toLowerCase() === "success" ? s(u) : c(u);
113
114
  }, []);
114
- return /* @__PURE__ */ h.jsx(
115
- N,
115
+ return /* @__PURE__ */ p.jsx(
116
+ E,
116
117
  {
117
118
  title: e,
118
- width: u,
119
- height: s,
119
+ width: i,
120
+ height: o,
120
121
  onClose: () => {
121
122
  },
122
123
  url: t,
123
- onCode: o,
124
+ onCode: r,
124
125
  children: n
125
126
  }
126
127
  );
127
- }, I = ({ children: e, provider: t }) => {
128
- const { title: n, urls: c, onSuccess: r, onError: u } = E(), s = c == null ? void 0 : c[t];
129
- return s ? /* @__PURE__ */ h.jsx(
130
- $,
128
+ }, N = ({ children: e, provider: t }) => {
129
+ const { title: n, urls: s, onSuccess: c, onError: i } = k(), o = s == null ? void 0 : s[t];
130
+ return o ? /* @__PURE__ */ p.jsx(
131
+ S,
131
132
  {
132
133
  title: n,
133
134
  provider: t,
134
- url: s,
135
- onSuccess: r,
136
- onError: u,
135
+ url: o,
136
+ onSuccess: c,
137
+ onError: i,
137
138
  children: e
138
139
  }
139
140
  ) : null;
140
141
  };
141
142
  class v {
142
143
  }
143
- x(v, "Container", A), x(v, "Button", I);
144
+ m(v, "Container", b), m(v, "Button", N);
144
145
  export {
145
146
  v as LevoOAuth
146
147
  };