zudoku 0.21.15 → 0.22.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.
Files changed (41) hide show
  1. package/dist/lib/components/Markdown.js +1 -1
  2. package/dist/lib/components/Markdown.js.map +1 -1
  3. package/dist/lib/components/ReactMarkdown.d.ts +29 -0
  4. package/dist/lib/components/ReactMarkdown.js +182 -0
  5. package/dist/lib/components/ReactMarkdown.js.map +1 -0
  6. package/dist/lib/plugins/search-inkeep/index.d.ts +22 -3
  7. package/dist/lib/plugins/search-inkeep/index.js +27 -5
  8. package/dist/lib/plugins/search-inkeep/index.js.map +1 -1
  9. package/dist/lib/plugins/search-inkeep/inkeep.d.ts +3 -4
  10. package/dist/lib/plugins/search-inkeep/inkeep.js.map +1 -1
  11. package/lib/{Markdown-CdkU5HcM.js → Markdown-CRsmPPfY.js} +13083 -13095
  12. package/lib/Markdown-CRsmPPfY.js.map +1 -0
  13. package/lib/{MdxPage-ChziqNPp.js → MdxPage-Wp8QU0-q.js} +2 -2
  14. package/lib/{MdxPage-ChziqNPp.js.map → MdxPage-Wp8QU0-q.js.map} +1 -1
  15. package/lib/{OperationList-CQKkyrZH.js → OperationList-u8xHU9-b.js} +3 -3
  16. package/lib/{OperationList-CQKkyrZH.js.map → OperationList-u8xHU9-b.js.map} +1 -1
  17. package/lib/{SlotletProvider-D77pO-fA.js → SlotletProvider-BgvYIPQe.js} +2 -2
  18. package/lib/{SlotletProvider-D77pO-fA.js.map → SlotletProvider-BgvYIPQe.js.map} +1 -1
  19. package/lib/{index-DjB6H4GT.js → index-CmdLGbbk.js} +2 -2
  20. package/lib/{index-DjB6H4GT.js.map → index-CmdLGbbk.js.map} +1 -1
  21. package/lib/zudoku.components.js +2 -2
  22. package/lib/zudoku.plugin-api-catalog.js +1 -1
  23. package/lib/zudoku.plugin-api-keys.js +1 -1
  24. package/lib/zudoku.plugin-custom-pages.js +1 -1
  25. package/lib/zudoku.plugin-markdown.js +1 -1
  26. package/lib/zudoku.plugin-openapi.js +1 -1
  27. package/lib/zudoku.plugin-search-inkeep.js +44 -23
  28. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  29. package/package.json +9 -3
  30. package/src/lib/components/Markdown.tsx +1 -1
  31. package/src/lib/components/ReactMarkdown.license.txt +21 -0
  32. package/src/lib/components/ReactMarkdown.tsx +264 -0
  33. package/src/lib/plugins/search-inkeep/index.tsx +59 -23
  34. package/src/lib/plugins/search-inkeep/inkeep.ts +3 -9
  35. package/dist/lib/plugins/search-inkeep/InkeepCustomTrigger.d.ts +0 -2
  36. package/dist/lib/plugins/search-inkeep/InkeepCustomTrigger.js +0 -3
  37. package/dist/lib/plugins/search-inkeep/InkeepCustomTrigger.js.map +0 -1
  38. package/lib/InkeepCustomTrigger-CE5-K5ex.js +0 -6
  39. package/lib/InkeepCustomTrigger-CE5-K5ex.js.map +0 -1
  40. package/lib/Markdown-CdkU5HcM.js.map +0 -1
  41. package/src/lib/plugins/search-inkeep/InkeepCustomTrigger.tsx +0 -3
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import ReactMarkdown from "react-markdown";
3
2
  import rehypeRaw from "rehype-raw";
4
3
  import remarkGfm from "remark-gfm";
5
4
  import { visit } from "unist-util-visit";
6
5
  import { MdxComponents } from "../util/MdxComponents.js";
6
+ import { ReactMarkdown } from "./ReactMarkdown.js";
7
7
  // same as in packages/dev-portal/framework/vite.ts
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  const rehypeCodeBlockPlugin = () => (tree) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.js","sourceRoot":"","sources":["../../../src/lib/components/Markdown.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,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AAG,EAAE,CAAC,CAAC,IAAS,EAAE,EAAE;IAChD,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAC9C,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,CAAC;AAClC,MAAM,aAAa,GAAG,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;AAEzD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,YAAY,GAAG,uCAAuC,CAAC;AAEpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,SAAS,GAIV,EAAE,EAAE,CAAC,CACJ,KAAC,aAAa,IACZ,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,SAAS,YAEnB,OAAO,GACM,CACjB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Element, Parents } from "hast";
2
+ import { Components as JsxRuntimeComponents } from "hast-util-to-jsx-runtime";
3
+ import { ReactElement } from "react";
4
+ import { Options as RemarkRehypeOptions } from "remark-rehype";
5
+ import { PluggableList } from "unified";
6
+ interface AllowElement {
7
+ (element: Readonly<Element>, index: number, parent: Readonly<Parents> | undefined): boolean | null | undefined;
8
+ }
9
+ interface UrlTransform {
10
+ (url: string, key: string, node: Readonly<Element>): string | null | undefined;
11
+ }
12
+ interface Components extends Partial<JsxRuntimeComponents> {
13
+ }
14
+ interface Options {
15
+ allowElement?: AllowElement | null;
16
+ allowedElements?: ReadonlyArray<string> | null;
17
+ children?: string | null;
18
+ className?: string | null;
19
+ components?: Components | null;
20
+ disallowedElements?: ReadonlyArray<string> | null;
21
+ rehypePlugins?: PluggableList | null;
22
+ remarkPlugins?: PluggableList | null;
23
+ remarkRehypeOptions?: Readonly<RemarkRehypeOptions> | null;
24
+ skipHtml?: boolean | null;
25
+ unwrapDisallowed?: boolean | null;
26
+ urlTransform?: UrlTransform | null;
27
+ }
28
+ export declare function ReactMarkdown(options: Readonly<Options>): ReactElement;
29
+ export {};
@@ -0,0 +1,182 @@
1
+ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
+ /**
4
+ * This is a fork of `react-markdown` converted to typescript.
5
+ * The reason we fork it is because react-markdown is comptaible with
6
+ * unified 11, but references the unified 10 and related packages causing
7
+ * type errors and a bunch of extra imports
8
+ *
9
+ * Source: https://github.com/remarkjs/react-markdown/blob/main/index.js
10
+ */
11
+ import { unreachable } from "devlop";
12
+ import { toJsxRuntime, } from "hast-util-to-jsx-runtime";
13
+ import { urlAttributes } from "html-url-attributes";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ import remarkParse from "remark-parse";
16
+ import remarkRehype from "remark-rehype";
17
+ import { unified } from "unified";
18
+ import { visit } from "unist-util-visit";
19
+ import { VFile } from "vfile";
20
+ const changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
21
+ const emptyPlugins = [];
22
+ const emptyRemarkRehypeOptions = {
23
+ allowDangerousHtml: true,
24
+ };
25
+ const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
26
+ const deprecations = [
27
+ { from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
28
+ { from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
29
+ {
30
+ from: "allowNode",
31
+ id: "replace-allownode-allowedtypes-and-disallowedtypes",
32
+ to: "allowElement",
33
+ },
34
+ {
35
+ from: "allowedTypes",
36
+ id: "replace-allownode-allowedtypes-and-disallowedtypes",
37
+ to: "allowedElements",
38
+ },
39
+ {
40
+ from: "disallowedTypes",
41
+ id: "replace-allownode-allowedtypes-and-disallowedtypes",
42
+ to: "disallowedElements",
43
+ },
44
+ { from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
45
+ { from: "includeElementIndex", id: "#remove-includeelementindex" },
46
+ {
47
+ from: "includeNodeIndex",
48
+ id: "change-includenodeindex-to-includeelementindex",
49
+ },
50
+ { from: "linkTarget", id: "remove-linktarget" },
51
+ {
52
+ from: "plugins",
53
+ id: "change-plugins-to-remarkplugins",
54
+ to: "remarkPlugins",
55
+ },
56
+ { from: "rawSourcePos", id: "#remove-rawsourcepos" },
57
+ { from: "renderers", id: "change-renderers-to-components", to: "components" },
58
+ { from: "source", id: "change-source-to-children", to: "children" },
59
+ { from: "sourcePos", id: "#remove-sourcepos" },
60
+ { from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
61
+ { from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" },
62
+ ];
63
+ export function ReactMarkdown(options) {
64
+ const allowedElements = options.allowedElements;
65
+ const allowElement = options.allowElement;
66
+ const children = options.children || "";
67
+ const className = options.className;
68
+ const components = options.components;
69
+ const disallowedElements = options.disallowedElements;
70
+ const rehypePlugins = options.rehypePlugins || emptyPlugins;
71
+ const remarkPlugins = options.remarkPlugins || emptyPlugins;
72
+ const remarkRehypeOptions = options.remarkRehypeOptions
73
+ ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions }
74
+ : emptyRemarkRehypeOptions;
75
+ const skipHtml = options.skipHtml;
76
+ const unwrapDisallowed = options.unwrapDisallowed;
77
+ const urlTransform = options.urlTransform || defaultUrlTransform;
78
+ const processor = unified()
79
+ .use(remarkParse)
80
+ .use(remarkPlugins)
81
+ .use(remarkRehype, remarkRehypeOptions)
82
+ .use(rehypePlugins);
83
+ const file = new VFile();
84
+ if (typeof children === "string") {
85
+ file.value = children;
86
+ }
87
+ else {
88
+ unreachable(`Unexpected value '${children}' for 'children' prop, expected 'string'`);
89
+ }
90
+ if (allowedElements && disallowedElements) {
91
+ unreachable("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other");
92
+ }
93
+ for (const deprecation of deprecations) {
94
+ if (Object.prototype.hasOwnProperty.call(options, deprecation.from)) {
95
+ unreachable(`Unexpected '${deprecation.from}' prop, ` +
96
+ (deprecation.to ? `use '${deprecation.to}' instead` : "remove it") +
97
+ ` (see <${changelog}#${deprecation.id}> for more info)`);
98
+ }
99
+ }
100
+ const mdastTree = processor.parse(file);
101
+ let hastTree = processor.runSync(mdastTree, file);
102
+ if (className) {
103
+ hastTree = {
104
+ type: "element",
105
+ tagName: "div",
106
+ properties: { className },
107
+ children: hastTree.type === "root"
108
+ ? hastTree.children
109
+ : [hastTree],
110
+ };
111
+ }
112
+ // Nodes type is slightly off, different versions of `hast` have different types
113
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
114
+ // @ts-ignore
115
+ visit(hastTree, transform);
116
+ return toJsxRuntime(hastTree, {
117
+ Fragment,
118
+ components,
119
+ ignoreInvalidStyle: true,
120
+ jsx,
121
+ jsxs,
122
+ passKeys: true,
123
+ passNode: true,
124
+ });
125
+ function transform(node, index, parent) {
126
+ if (node.type === "raw" && parent && typeof index === "number") {
127
+ if (skipHtml) {
128
+ parent.children.splice(index, 1);
129
+ }
130
+ else {
131
+ parent.children[index] = { type: "text", value: node.value };
132
+ }
133
+ return index;
134
+ }
135
+ if (node.type === "element") {
136
+ for (const key in urlAttributes) {
137
+ if (Object.prototype.hasOwnProperty.call(urlAttributes, key) &&
138
+ Object.prototype.hasOwnProperty.call(node.properties, key)) {
139
+ const value = node.properties[key];
140
+ const test = urlAttributes[key];
141
+ if (test === null ||
142
+ test === undefined ||
143
+ test.includes(node.tagName)) {
144
+ node.properties[key] = urlTransform(String(value || ""), key, node);
145
+ }
146
+ }
147
+ }
148
+ let remove = allowedElements
149
+ ? !allowedElements.includes(node.tagName)
150
+ : disallowedElements
151
+ ? disallowedElements.includes(node.tagName)
152
+ : false;
153
+ if (!remove && allowElement && typeof index === "number") {
154
+ remove = !allowElement(node, index, parent);
155
+ }
156
+ if (remove && parent && typeof index === "number") {
157
+ if (unwrapDisallowed && node.children) {
158
+ parent.children.splice(index, 1, ...node.children);
159
+ }
160
+ else {
161
+ parent.children.splice(index, 1);
162
+ }
163
+ return index;
164
+ }
165
+ }
166
+ }
167
+ }
168
+ function defaultUrlTransform(value) {
169
+ const colon = value.indexOf(":");
170
+ const questionMark = value.indexOf("?");
171
+ const numberSign = value.indexOf("#");
172
+ const slash = value.indexOf("/");
173
+ if (colon < 0 ||
174
+ (slash > -1 && colon > slash) ||
175
+ (questionMark > -1 && colon > questionMark) ||
176
+ (numberSign > -1 && colon > numberSign) ||
177
+ safeProtocol.test(value.slice(0, colon))) {
178
+ return value;
179
+ }
180
+ return "";
181
+ }
182
+ //# sourceMappingURL=ReactMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactMarkdown.js","sourceRoot":"","sources":["../../../src/lib/components/ReactMarkdown.tsx"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,gEAAgE;AAEhE;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAEL,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,YAAgD,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAiB,OAAO,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,SAAS,GACb,mEAAmE,CAAC;AAEtE,MAAM,YAAY,GAAkB,EAAE,CAAC;AACvC,MAAM,wBAAwB,GA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AAC;QAC3C,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,UAAU,CAAC;QACvC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EACxC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -1,6 +1,25 @@
1
- import type { InkeepWidgetBaseSettings } from "@inkeep/widgets";
2
1
  import type { ZudokuPlugin } from "../../core/plugins.js";
3
- type PickedPluginInkeepBaseSettings = "apiKey" | "integrationId" | "organizationId" | "primaryBrandColor" | "organizationDisplayName";
4
- type PluginInkeepBaseSettings = Pick<InkeepWidgetBaseSettings, PickedPluginInkeepBaseSettings>;
2
+ interface PluginInkeepBaseSettings {
3
+ apiKey?: string;
4
+ integrationId: string;
5
+ organizationId: string;
6
+ organizationDisplayName?: string;
7
+ primaryBrandColor: string;
8
+ }
9
+ interface InkeepEmbedConfig {
10
+ componentType: string;
11
+ targetElement: HTMLElement;
12
+ properties: unknown;
13
+ }
14
+ interface InkeepWidget {
15
+ render: (config: InkeepEmbedConfig & {
16
+ isOpen: boolean;
17
+ }) => void;
18
+ }
19
+ declare global {
20
+ let Inkeep: () => {
21
+ embed: (config: InkeepEmbedConfig) => InkeepWidget;
22
+ };
23
+ }
5
24
  export declare const inkeepSearchPlugin: (settings: PluginInkeepBaseSettings) => ZudokuPlugin;
6
25
  export {};
@@ -1,15 +1,37 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { lazy } from "react";
2
+ import { useEffect, useMemo, useRef } from "react";
3
3
  import { ClientOnly } from "../../components/ClientOnly.js";
4
4
  import { aiChatSettings, baseSettings } from "./inkeep.js";
5
- const Inkeep = lazy(() => import("./InkeepCustomTrigger.js"));
6
5
  const InkeepSearch = ({ prefilledQuery, isOpen, onClose, settings, }) => {
7
- return (_jsx(Inkeep, { isOpen: isOpen, onClose: onClose, baseSettings: { ...baseSettings, ...settings }, aiChatSettings: aiChatSettings, searchSettings: {
8
- prefilledQuery: prefilledQuery || undefined,
9
- } }));
6
+ const ref = useRef(null);
7
+ const config = useMemo(() => ({
8
+ componentType: "CustomTrigger",
9
+ targetElement: ref.current,
10
+ properties: {
11
+ isOpen,
12
+ onClose,
13
+ onOpen: undefined,
14
+ baseSettings: { ...baseSettings, ...settings },
15
+ searchSettings: {
16
+ prefilledQuery: prefilledQuery || undefined,
17
+ },
18
+ aiChatSettings,
19
+ },
20
+ }), [isOpen, onClose, prefilledQuery, settings, ref]);
21
+ useEffect(() => {
22
+ const inkeepWidget = Inkeep().embed(config);
23
+ inkeepWidget.render({
24
+ ...config,
25
+ isOpen,
26
+ });
27
+ });
28
+ return _jsx("div", { ref: ref });
10
29
  };
11
30
  export const inkeepSearchPlugin = (settings) => {
12
31
  return {
32
+ getHead: () => {
33
+ return (_jsx("script", { type: "module", src: "https://unpkg.com/@inkeep/uikit-js@0.3.19/dist/embed.js", defer: true }));
34
+ },
13
35
  renderSearch: ({ isOpen, onClose, }) => {
14
36
  return (_jsx(ClientOnly, { children: _jsx(InkeepSearch, { isOpen: isOpen, onClose: onClose, settings: settings }) }));
15
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/plugins/search-inkeep/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAc3D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAE9D,MAAM,YAAY,GAAG,CAAC,EACpB,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,GAMT,EAAE,EAAE;IACH,OAAO,CACL,KAAC,MAAM,IACL,MAAM,EA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AAc,EAAE,cAAc,IAAI,SAAS;aAC5C;YACD,cAAc;SACf;KACF,CAAC,EACF,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,CAAC,CACjD,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5C,YAAY,CAAC,MAAM,CAAC;YAClB,GAAG,MAAM;YACT,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,cAAK,GAAG,EAAE,GAAG,GAAI,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,QAAkC,EACpB,EAAE;IAChB,OAAO;QACL,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,GAAG,EAAC,yDAAyD,EAC7D,KAAK,SACG,CACX,CAAC;QACJ,CAAC;QACD,YAAY,EAAE,CAAC,EACb,MAAM,EACN,OAAO,GAIR,EAAE,EAAE;YACH,OAAO,CACL,KAAC,UAAU,cACT,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAC3D,CACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,3 @@
1
- import { InkeepAIChatSettings, InkeepModalSettings, InkeepSearchSettings } from "@inkeep/widgets";
2
1
  declare const baseSettings: {
3
2
  readonly theme: {
4
3
  readonly components: {
@@ -17,7 +16,7 @@ declare const baseSettings: {
17
16
  };
18
17
  };
19
18
  };
20
- declare const modalSettings: InkeepModalSettings;
21
- declare const searchSettings: InkeepSearchSettings;
22
- declare const aiChatSettings: InkeepAIChatSettings;
19
+ declare const modalSettings: {};
20
+ declare const searchSettings: {};
21
+ declare const aiChatSettings: {};
23
22
  export { aiChatSettings, baseSettings, modalSettings, searchSettings };
@@ -1 +1 @@
1
- {"version":3,"file":"inkeep.js","sourceRoot":"","sources":["../../../../src/lib/plugins/search-inkeep/inkeep.ts"],"names":[],"mappings":"AAMA,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE;QACL,UAAU,EAAE;YACV,iBAAiB,EAAE;gBACjB,YAAY,EAAE;oBACZ,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,WAAW;iBACrB;aACF;YACD,gBAAgB,EAAE;gBAChB,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,QAAQ,EAAE,uCAAuC;iBAC3D;aACF;SACF;KACF;CACO,CAAC;AAEX,MAAM,aAAa,GAAwB,EAAE,CAAC;AAE9C,MAAM,cAAc,GAAyB,EAAE,CAAC;AAEhD,MAAM,cAAc,GAAyB,EAAE,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"inkeep.js","sourceRoot":"","sources":["../../../../src/lib/plugins/search-inkeep/inkeep.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE;QACL,UAAU,EAAE;YACV,iBAAiB,EAAE;gBACjB,YAAY,EAAE;oBACZ,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,WAAW;iBACrB;aACF;YACD,gBAAgB,EAAE;gBAChB,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,QAAQ,EAAE,uCAAuC;iBAC3D;aACF;SACF;KACF;CACO,CAAC;AAEX,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}