@luma-ai/react 0.1.0 → 2.0.1

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 (41) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +18 -12
  3. package/dist/chunks/src-C48p0wsr.js +7647 -0
  4. package/dist/chunks/src-C48p0wsr.js.map +1 -0
  5. package/dist/chunks/support-cursor-BU9gztRA.js +131 -0
  6. package/dist/chunks/support-cursor-BU9gztRA.js.map +1 -0
  7. package/dist/chunks/visitor-call-CoKCjk8c.js +1129 -0
  8. package/dist/chunks/visitor-call-CoKCjk8c.js.map +1 -0
  9. package/dist/chunks/visitor-cobrowse-Ba7H1VtS.js +1415 -0
  10. package/dist/chunks/visitor-cobrowse-Ba7H1VtS.js.map +1 -0
  11. package/dist/{config-CCT7m9eE.d.ts → config-BAC3xPNG.d.ts} +1 -6
  12. package/dist/index-ByvZMuLw.d.ts +415 -0
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.js +1 -2
  15. package/dist/next.d.ts +3 -5
  16. package/dist/next.js +2 -3
  17. package/dist/next.js.map +1 -1
  18. package/dist/react-router.d.ts +3 -5
  19. package/dist/react-router.js +2 -3
  20. package/dist/react-router.js.map +1 -1
  21. package/dist/server.d.ts +1 -3
  22. package/dist/server.js +11 -12
  23. package/dist/server.js.map +1 -1
  24. package/dist/tanstack.d.ts +3 -5
  25. package/dist/tanstack.js +2 -3
  26. package/dist/tanstack.js.map +1 -1
  27. package/docs/ai-agents.md +5 -5
  28. package/docs/appearance.md +92 -0
  29. package/docs/data-sources.md +18 -18
  30. package/docs/features.md +62 -0
  31. package/docs/hooks.md +22 -8
  32. package/docs/index.md +17 -7
  33. package/docs/options.md +58 -51
  34. package/docs/privacy.md +29 -6
  35. package/docs/server.md +11 -7
  36. package/docs/troubleshooting.md +16 -8
  37. package/package.json +28 -21
  38. package/skills/luma-ai-react/SKILL.md +32 -13
  39. package/dist/chunks/src-dnp1waFV.js +0 -3100
  40. package/dist/chunks/src-dnp1waFV.js.map +0 -1
  41. package/dist/index-BdkoFDyP.d.ts +0 -189
@@ -1,189 +0,0 @@
1
- import { a as SiteContext, n as LumaServer, o as SiteProduct, r as LumaActionDefinition, t as LumaAppearance } from "./config-CCT7m9eE.js";
2
- import { HTMLAttributes, ReactNode } from "react";
3
- //#region src/core/policy.d.ts
4
- /** Where the assistant may look and which URLs it may open on this website. */
5
- type SitePolicy = {
6
- /** Pages with no inspection, guides or navigation (for example an admin area). */
7
- restrictedPaths: RegExp[];
8
- /** State-changing URLs the assistant must never open, such as logout. */
9
- blockedPaths: RegExp[];
10
- /** Query parameters that make a URL state-changing or secret-bearing. */
11
- blockedParams: string[];
12
- /** Regions whose text and controls are never read. */
13
- privateSelector: string;
14
- };
15
- //#endregion
16
- //#region src/core/data-sources.d.ts
17
- /** A page the assistant may suggest. Relative URLs resolve against this site. */
18
- type LumaLink = {
19
- title: string;
20
- url: string;
21
- description?: string;
22
- /** Stable ID; derived from the URL when omitted. */
23
- id?: string;
24
- };
25
- type LumaSiteInfo = {
26
- name?: string;
27
- language?: string;
28
- currency?: string;
29
- menus?: LumaLink[];
30
- /** Public page directory. Also used for searchSite when no search function is given. */
31
- pages?: LumaLink[];
32
- [key: string]: unknown;
33
- };
34
- type LumaProduct = Omit<SiteProduct, "id" | "image" | "currency" | "type" | "attributes" | "price"> & {
35
- id?: string;
36
- image?: string | null;
37
- price: string | number;
38
- currency?: string;
39
- type?: string;
40
- attributes?: Record<string, string[]>;
41
- };
42
- /** Extra fields (e.g. a price note) are passed to the assistant as-is. */
43
- type LumaSearchResult<T> = {
44
- items: T[];
45
- hasMore?: boolean;
46
- [key: string]: unknown;
47
- };
48
- type LumaDataSourceContext = {
49
- sessionId: string;
50
- signal: AbortSignal;
51
- };
52
- type LumaProductQuery = {
53
- query: string;
54
- minPrice?: number | null;
55
- maxPrice?: number | null;
56
- category?: string | null;
57
- inStock: boolean;
58
- page: number;
59
- };
60
- /** Live data the assistant reads from your app. Every function runs in the visitor's browser. */
61
- type LumaDataSources = {
62
- site?: LumaSiteInfo | ((context: LumaDataSourceContext) => LumaSiteInfo | Promise<LumaSiteInfo>);
63
- searchSite?: (input: {
64
- query: string;
65
- page: number;
66
- }, context: LumaDataSourceContext) => Promise<LumaSearchResult<LumaLink>>;
67
- searchProducts?: (input: LumaProductQuery, context: LumaDataSourceContext) => Promise<LumaSearchResult<LumaProduct>>;
68
- getProduct?: (input: {
69
- productId: number | string;
70
- }, context: LumaDataSourceContext) => Promise<LumaProduct | null>;
71
- };
72
- //#endregion
73
- //#region src/core/navigation.d.ts
74
- /** How the assistant opens pages on this website. */
75
- type LumaNavigation = {
76
- /** Open a same-origin URL that already passed the site policy. */
77
- navigate: (url: string) => void;
78
- /** True when navigate keeps this document (client-side routing). */
79
- client?: boolean;
80
- };
81
- //#endregion
82
- //#region src/core/site-runtime.d.ts
83
- type Landmark = {
84
- path: string;
85
- selector: string;
86
- label: string;
87
- fingerprint: string;
88
- };
89
- //#endregion
90
- //#region src/provider.d.ts
91
- type LumaProviderProps = LumaAppearance & {
92
- children?: ReactNode;
93
- /**
94
- * Your backend route made with createLumaSessionHandler. Recommended: the API key stays on
95
- * your server.
96
- */
97
- sessionEndpoint?: string;
98
- /**
99
- * Assistant ID for client-only apps without a backend. Requires keyless access and this
100
- * site's domain in the Luma dashboard. Ignored when sessionEndpoint is set.
101
- */
102
- assistantId?: string;
103
- /** Luma API host: "internal" (ir.lumai.ir, default) or "direct" (dash.lumai.ir). */
104
- server?: LumaServer;
105
- /** Overrides the Luma API base URL, e.g. for local development. */
106
- apiBaseUrl?: string;
107
- /** Live data the assistant reads from your app. */
108
- dataSources?: LumaDataSources;
109
- /** Actions this page tree can run. Required in client-only mode to declare them. */
110
- actions?: LumaActionDefinition[];
111
- /** Disable navigation suggestions or on-page guides. Both are on by default. */
112
- features?: {
113
- navigation?: boolean;
114
- guides?: boolean;
115
- };
116
- /** Paths where the assistant cannot look, guide or navigate, e.g. "/admin". */
117
- restrictedPaths?: Array<string | RegExp>;
118
- /** Extra state-changing paths and query parameters the assistant must never open. */
119
- blockedPaths?: Array<string | RegExp>;
120
- blockedParams?: string[];
121
- /** CSS selectors of regions whose content is never read, in addition to data-luma-private. */
122
- privateSelectors?: string[];
123
- /** Hide the widget (for example on some routes) while keeping hooks working. */
124
- disabled?: boolean;
125
- /** Client-side router integration. Set by the next, react-router and tanstack entries. */
126
- navigator?: LumaNavigation;
127
- /** @internal Host-provided values used by the WordPress plugin. */
128
- host?: {
129
- chatEndpoint?: string;
130
- siteContext?: SiteContext;
131
- landmarks?: Landmark[];
132
- restricted?: boolean;
133
- policy?: SitePolicy;
134
- storageScope?: string;
135
- };
136
- };
137
- /**
138
- * Adds the Luma assistant to every page below it and enables useLuma, useLumaContext and
139
- * useLumaAction. Place it once, near the root of your app.
140
- */
141
- declare function LumaProvider(props: LumaProviderProps): import("react").JSX.Element;
142
- //#endregion
143
- //#region src/core/controller.d.ts
144
- type LumaStatus = "connecting" | "ready" | "busy" | "error" | "disabled";
145
- type LumaState = {
146
- isOpen: boolean;
147
- status: LumaStatus;
148
- };
149
- type LumaActionHandler<Input = unknown> = (input: Input) => unknown | Promise<unknown>;
150
- //#endregion
151
- //#region src/hooks.d.ts
152
- /** Control the assistant from your own UI, e.g. an "Ask about this product" button. */
153
- declare function useLuma(): {
154
- isOpen: boolean;
155
- status: LumaStatus;
156
- open: () => void;
157
- close: () => void;
158
- toggle: () => void;
159
- /** Opens the chat and sends text. Returns false while a reply is in progress. */
160
- ask: (text: string) => boolean;
161
- newChat: () => void | undefined;
162
- };
163
- /**
164
- * Share structured state of the current page with the assistant (included when it inspects
165
- * the page). Keep it small and free of secrets; it leaves the browser.
166
- */
167
- declare function useLumaContext(name: string, value: unknown): void;
168
- /**
169
- * Let the assistant run an action on this page. The handler receives validated input; its
170
- * JSON-serializable return value is reported to the assistant. Define the action at module
171
- * level with defineAction so its identity is stable.
172
- */
173
- declare function useLumaAction<Input>(definition: LumaActionDefinition<Input>, handler: LumaActionHandler<Input>): void;
174
- //#endregion
175
- //#region src/markers.d.ts
176
- /** Content inside is invisible to the assistant: never read, never targeted by guides. */
177
- declare function LumaPrivate(props: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
178
- //#endregion
179
- //#region src/core/markers.d.ts
180
- /** Name an unlabeled section so the assistant can find it and guide visitors to it. */
181
- declare const lumaLabel: (label: string) => {
182
- "data-luma-label": string;
183
- };
184
- /** Spread on an element whose content the assistant must never read. */
185
- declare const lumaPrivate: () => {
186
- "data-luma-private": string;
187
- };
188
- //#endregion
189
- export { LumaProductQuery as _, useLumaAction as a, LumaState as c, LumaProviderProps as d, LumaNavigation as f, LumaProduct as g, LumaLink as h, useLuma as i, LumaStatus as l, LumaDataSources as m, lumaPrivate as n, useLumaContext as o, LumaDataSourceContext as p, LumaPrivate as r, LumaActionHandler as s, lumaLabel as t, LumaProvider as u, LumaSearchResult as v, LumaSiteInfo as y };