@levo-so/react 0.1.113 → 0.3.7
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/dist/audience/components/block.d.ts +18 -2
- package/dist/audience/components/block.js +1 -1
- package/dist/audience/components/page.d.ts +18 -2
- package/dist/audience/index.d.ts +2 -3
- package/dist/components/Sonner.d.ts +3 -0
- package/dist/components/index.d.ts +0 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +7 -22
- package/dist/membership/components/Button.js +15 -16
- package/dist/providers/LevoProvider.d.ts +7 -0
- package/dist/providers/LevoProvider.js +2 -2
- package/dist/styles/index.css +1 -1
- package/dist/utils/index.d.ts +0 -6
- package/package.json +8 -19
- package/dist/audience/components/component.d.ts +0 -8
- package/dist/audience/components/component.js +0 -19
- package/dist/components/Dialog.d.ts +0 -24
- package/dist/components/Dialog.js +0 -57
- package/dist/components/DialogWrapper.d.ts +0 -12
- package/dist/components/DialogWrapper.js +0 -20
- package/dist/components/Spinner.d.ts +0 -5
- package/dist/components/Spinner.js +0 -7
- package/dist/components/Table.d.ts +0 -11
- package/dist/components/Tabs.d.ts +0 -8
- package/dist/components/Tabs.js +0 -27
- package/dist/components/Tooltip.d.ts +0 -17
- package/dist/components/Tooltip.js +0 -24
- package/dist/components/button/Button.d.ts +0 -12
- package/dist/components/button/Button.js +0 -24
- package/dist/components/button/buttonVariants.d.ts +0 -6
- package/dist/components/button/buttonVariants.js +0 -38
- package/dist/components/button/index.d.ts +0 -3
- package/dist/constants/fileUploadPresets.d.ts +0 -42
- package/dist/constants/fileUploadPresets.js +0 -80
- package/dist/constants/index.d.ts +0 -2
- package/dist/utils/byteToSize.d.ts +0 -3
- package/dist/utils/byteToSize.js +0 -18
- package/dist/utils/cn.d.ts +0 -4
- package/dist/utils/cn.js +0 -6
- package/dist/utils/isDateObject.d.ts +0 -2
- package/dist/utils/isDateObject.js +0 -4
- package/dist/utils/isEmptyObject.d.ts +0 -5
- package/dist/utils/isEmptyObject.js +0 -5
- package/dist/utils/isNullOrUndefined.d.ts +0 -2
- package/dist/utils/isNullOrUndefined.js +0 -4
- package/dist/utils/isObject.d.ts +0 -3
- package/dist/utils/isObject.js +0 -6
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { ILevoAudience } from '@levo-so/insights';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Fires a one-time `block.view` audience event when the block scrolls into view.
|
|
5
|
+
*
|
|
6
|
+
* Renders nothing. Mount it inside a block wrapper and pass the DOM `id` of the
|
|
7
|
+
* element to observe; the event fires once per instance, the first time that
|
|
8
|
+
* element intersects the viewport. On a failed `track()` the observer stays
|
|
9
|
+
* connected, so re-entering the viewport is a natural retry.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <div id={block.id}>
|
|
14
|
+
* <LevoInsightsBlock id={block.id} properties={{ resource: "block" }} />
|
|
15
|
+
* {block.children}
|
|
16
|
+
* </div>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const LevoInsightsBlock: React.FC<{
|
|
4
20
|
id: string;
|
|
5
21
|
properties?: ILevoAudience.Properties;
|
|
6
22
|
}>;
|
|
7
|
-
export default
|
|
23
|
+
export default LevoInsightsBlock;
|
|
8
24
|
//# sourceMappingURL=block.d.ts.map
|
|
@@ -17,7 +17,7 @@ var a = ({ id: a, properties: o = {} }) => {
|
|
|
17
17
|
identifier: a
|
|
18
18
|
}), l.current = !0, t.disconnect();
|
|
19
19
|
} catch (e) {
|
|
20
|
-
s?.error("[
|
|
20
|
+
s?.error("[LevoInsightsBlock] track failed", { exception: n(e) });
|
|
21
21
|
}
|
|
22
22
|
}, { threshold: 0 });
|
|
23
23
|
return t.observe(e), () => t.disconnect();
|
|
@@ -6,8 +6,24 @@ declare global {
|
|
|
6
6
|
levo_insights?: ILevoInsights;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Initializes audience/page tracking for a rendered Levo page.
|
|
11
|
+
*
|
|
12
|
+
* Renders nothing. Mount once per page (typically at the page root). It exposes
|
|
13
|
+
* the client/insights runtimes on `window` and calls `insights.init()` so page
|
|
14
|
+
* views and the welcome event fire. `id` is optional because headless sites
|
|
15
|
+
* mount this without a page id and still need `init()` to run.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <>
|
|
20
|
+
* <LevoInsightsPage id={page.id} />
|
|
21
|
+
* {page.children}
|
|
22
|
+
* </>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const LevoInsightsPage: React.FC<{
|
|
10
26
|
id?: string;
|
|
11
27
|
}>;
|
|
12
|
-
export default
|
|
28
|
+
export default LevoInsightsPage;
|
|
13
29
|
//# sourceMappingURL=page.d.ts.map
|
package/dist/audience/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { default as LevoInsightsPage } from './components/page';
|
|
1
|
+
export { LevoInsightsBlock } from './components/block';
|
|
2
|
+
export { LevoInsightsPage } from './components/page';
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ExternalToast, Toaster as Sonner, toast } from 'sonner';
|
|
2
2
|
type ToasterProps = React.ComponentProps<typeof Sonner>;
|
|
3
|
+
/** App-level toast host. Mount once near the root; styled to Levo's theme tokens. */
|
|
3
4
|
export declare const Toaster: ({ ...props }: ToasterProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/** Show an error toast (title + description) at bottom-right. */
|
|
4
6
|
export declare const errorToast: (message: string, title?: string, options?: ExternalToast) => void;
|
|
7
|
+
/** Show a success toast; dismisses a prior toast with the same id first. */
|
|
5
8
|
export declare const successToast: (message: string | React.ReactNode, title?: string, options?: ExternalToast) => void;
|
|
6
9
|
export { toast, type ExternalToast };
|
|
7
10
|
//# sourceMappingURL=Sonner.d.ts.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import { LevoProvider as e, useLevo as t,
|
|
3
|
-
import
|
|
4
|
-
import i from "./audience/components/component.js";
|
|
2
|
+
import { LevoProvider as e, useLevo as t, useLevoClient as n, useLevoInsights as r } from "./providers/LevoProvider.js";
|
|
3
|
+
import i from "./audience/components/block.js";
|
|
5
4
|
import a from "./audience/components/page.js";
|
|
6
|
-
import o from "./
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { Toaster as b, errorToast as x, successToast as S, toast as C } from "./components/Sonner.js";
|
|
12
|
-
import w from "./components/Spinner.js";
|
|
13
|
-
import { Tabs as T, TabsContent as E, TabsList as D, TabsTrigger as O } from "./components/Tabs.js";
|
|
14
|
-
import { SimpleTooltipWrapper as k, Tooltip as A, TooltipContent as j, TooltipPortal as M, TooltipProvider as N, TooltipTrigger as P } from "./components/Tooltip.js";
|
|
15
|
-
import { allMediaFileExtensions as F, allMediaMimetypes as I, audioFileExtensions as L, audioMimetype as R, documentFileExtensions as z, documentMimetype as B, imageFileExtensions as V, imageMimetype as H, mediaExtensionsByKind as U, mediaMimetypeByKind as W, videoFileExtensions as G, videoMimetype as K } from "./constants/fileUploadPresets.js";
|
|
16
|
-
import { useLevoOAuth as q } from "./membership/useLevoOAuth.js";
|
|
17
|
-
import { LevoOAuth as J } from "./membership/index.js";
|
|
18
|
-
import Y from "./utils/byteToSize.js";
|
|
19
|
-
import { errorHandler as X } from "./utils/errorHandler.js";
|
|
20
|
-
import { isDateObject as Z } from "./utils/isDateObject.js";
|
|
21
|
-
import { isNullOrUndefined as Q } from "./utils/isNullOrUndefined.js";
|
|
22
|
-
import { isObject as $, isObjectType as ee } from "./utils/isObject.js";
|
|
23
|
-
import { isEmptyObject as te } from "./utils/isEmptyObject.js";
|
|
24
|
-
export { c as Button, l as Dialog, u as DialogClose, d as DialogContent, f as DialogDescription, p as DialogFooter, m as DialogHeader, h as DialogOverlay, g as DialogPortal, _ as DialogTitle, v as DialogTrigger, y as DialogWrapper, r as LevoInsightsBlock, i as LevoInsightsComponent, a as LevoInsightsPage, J as LevoOAuth, e as LevoProvider, k as SimpleTooltipWrapper, w as Spinner, T as Tabs, E as TabsContent, D as TabsList, O as TabsTrigger, b as Toaster, A as Tooltip, j as TooltipContent, M as TooltipPortal, N as TooltipProvider, P as TooltipTrigger, F as allMediaFileExtensions, I as allMediaMimetypes, L as audioFileExtensions, R as audioMimetype, s as buttonVariants, Y as byteToSize, o as cn, z as documentFileExtensions, B as documentMimetype, X as errorHandler, x as errorToast, V as imageFileExtensions, H as imageMimetype, Z as isDateObject, te as isEmptyObject, Q as isNullOrUndefined, $ as isObject, ee as isObjectType, U as mediaExtensionsByKind, W as mediaMimetypeByKind, S as successToast, C as toast, t as useLevo, n as useLevoInsights, q as useLevoOAuth, G as videoFileExtensions, K as videoMimetype };
|
|
5
|
+
import { Toaster as o, errorToast as s, successToast as c, toast as l } from "./components/Sonner.js";
|
|
6
|
+
import { useLevoOAuth as u } from "./membership/useLevoOAuth.js";
|
|
7
|
+
import { LevoOAuth as d } from "./membership/index.js";
|
|
8
|
+
import { errorHandler as f } from "./utils/errorHandler.js";
|
|
9
|
+
export { i as LevoInsightsBlock, a as LevoInsightsPage, d as LevoOAuth, e as LevoProvider, o as Toaster, f as errorHandler, s as errorToast, c as successToast, l as toast, t as useLevo, n as useLevoClient, r as useLevoInsights, u as useLevoOAuth };
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "
|
|
3
|
-
import
|
|
4
|
-
import n from "
|
|
5
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useLevoOAuth as e } from "./Container.js";
|
|
3
|
+
import t from "./Core.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
5
|
//#region src/membership/components/Button.tsx
|
|
7
|
-
var
|
|
8
|
-
let { title:
|
|
9
|
-
return
|
|
10
|
-
title:
|
|
11
|
-
provider:
|
|
12
|
-
url:
|
|
13
|
-
onSuccess:
|
|
14
|
-
onError:
|
|
15
|
-
children:
|
|
6
|
+
var r = ({ children: r, provider: i }) => {
|
|
7
|
+
let { title: a, urls: o, isLoading: s, onSuccess: c, onError: l } = e(), u = o?.[i];
|
|
8
|
+
return u ? /* @__PURE__ */ n(t, {
|
|
9
|
+
title: a,
|
|
10
|
+
provider: i,
|
|
11
|
+
url: u,
|
|
12
|
+
onSuccess: c,
|
|
13
|
+
onError: l,
|
|
14
|
+
children: s ? /* @__PURE__ */ n("div", {
|
|
16
15
|
className: "w-full items-center justify-center",
|
|
17
|
-
children: /* @__PURE__ */
|
|
18
|
-
}) :
|
|
16
|
+
children: /* @__PURE__ */ n("span", { className: "inline-block h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent" })
|
|
17
|
+
}) : r
|
|
19
18
|
}) : null;
|
|
20
19
|
};
|
|
21
20
|
//#endregion
|
|
22
|
-
export {
|
|
21
|
+
export { r as default };
|
|
@@ -8,6 +8,13 @@ interface ILevoProps {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const LevoProvider: React.FC<ILevoProps>;
|
|
10
10
|
export declare const useLevo: () => ILevoClient;
|
|
11
|
+
/**
|
|
12
|
+
* Null-safe counterpart to `useLevo` — returns the client or `null` when no provider is
|
|
13
|
+
* mounted (or it's mounted without a client). Use where a missing client is a valid state
|
|
14
|
+
* that should degrade gracefully rather than throw (e.g. Studio v3 sites before their Levo
|
|
15
|
+
* env is injected).
|
|
16
|
+
*/
|
|
17
|
+
export declare const useLevoClient: () => ILevoClient | null;
|
|
11
18
|
export declare const useLevoInsights: () => ILevoInsights | null;
|
|
12
19
|
export {};
|
|
13
20
|
//# sourceMappingURL=LevoProvider.d.ts.map
|
|
@@ -15,6 +15,6 @@ var r = e({
|
|
|
15
15
|
let e = t(r);
|
|
16
16
|
if (!e.client) throw Error("useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider.");
|
|
17
17
|
return e.client;
|
|
18
|
-
}, o = () => t(r).insights;
|
|
18
|
+
}, o = () => t(r).client, s = () => t(r).insights;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { i as LevoProvider, a as useLevo, o as useLevoInsights };
|
|
20
|
+
export { i as LevoProvider, a as useLevo, o as useLevoClient, s as useLevoInsights };
|