ai12z 0.0.1-alpha.8

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/ai12z-chat_3.cjs.entry.js +395 -0
  3. package/dist/cjs/ai12z-chat_3.cjs.entry.js.map +1 -0
  4. package/dist/cjs/ai12z-spinner.cjs.entry.js +22 -0
  5. package/dist/cjs/ai12z-spinner.cjs.entry.js.map +1 -0
  6. package/dist/cjs/index-6be98462.js +1967 -0
  7. package/dist/cjs/index-6be98462.js.map +1 -0
  8. package/dist/cjs/index.cjs.js +4 -0
  9. package/dist/cjs/index.cjs.js.map +1 -0
  10. package/dist/cjs/library.cjs.js +25 -0
  11. package/dist/cjs/library.cjs.js.map +1 -0
  12. package/dist/cjs/loader.cjs.js +15 -0
  13. package/dist/cjs/loader.cjs.js.map +1 -0
  14. package/dist/collection/collection-manifest.json +15 -0
  15. package/dist/collection/components/ai12z-cta/ai12z-cta.css +1 -0
  16. package/dist/collection/components/ai12z-cta/ai12z-cta.js +340 -0
  17. package/dist/collection/components/ai12z-cta/ai12z-cta.js.map +1 -0
  18. package/dist/collection/components/ai12z-cta/components/Chat.js +112 -0
  19. package/dist/collection/components/ai12z-cta/components/Chat.js.map +1 -0
  20. package/dist/collection/components/ai12z-cta/components/Form.js +32 -0
  21. package/dist/collection/components/ai12z-cta/components/Form.js.map +1 -0
  22. package/dist/collection/components/ai12z-cta/components/SearchResult.js +8 -0
  23. package/dist/collection/components/ai12z-cta/components/SearchResult.js.map +1 -0
  24. package/dist/collection/components/ai12z-cta/components/ai12z-chat.css +1 -0
  25. package/dist/collection/components/input/Input.js +130 -0
  26. package/dist/collection/components/input/Input.js.map +1 -0
  27. package/dist/collection/components/input/input.css +1 -0
  28. package/dist/collection/components/spinner/Spinner.js +44 -0
  29. package/dist/collection/components/spinner/Spinner.js.map +1 -0
  30. package/dist/collection/components/spinner/spinner.css +1 -0
  31. package/dist/collection/index.js +2 -0
  32. package/dist/collection/index.js.map +1 -0
  33. package/dist/collection/utils/utils.js +86 -0
  34. package/dist/collection/utils/utils.js.map +1 -0
  35. package/dist/collection/utils/utils.spec.js +16 -0
  36. package/dist/collection/utils/utils.spec.js.map +1 -0
  37. package/dist/esm/ai12z-chat_3.entry.js +389 -0
  38. package/dist/esm/ai12z-chat_3.entry.js.map +1 -0
  39. package/dist/esm/ai12z-spinner.entry.js +18 -0
  40. package/dist/esm/ai12z-spinner.entry.js.map +1 -0
  41. package/dist/esm/index-4dc12b55.js +1938 -0
  42. package/dist/esm/index-4dc12b55.js.map +1 -0
  43. package/dist/esm/index.js +3 -0
  44. package/dist/esm/index.js.map +1 -0
  45. package/dist/esm/library.js +20 -0
  46. package/dist/esm/library.js.map +1 -0
  47. package/dist/esm/loader.js +11 -0
  48. package/dist/esm/loader.js.map +1 -0
  49. package/dist/esm/polyfills/core-js.js +11 -0
  50. package/dist/esm/polyfills/dom.js +79 -0
  51. package/dist/esm/polyfills/es5-html-element.js +1 -0
  52. package/dist/esm/polyfills/index.js +34 -0
  53. package/dist/esm/polyfills/system.js +6 -0
  54. package/dist/index.cjs.js +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/library/index.esm.js +2 -0
  57. package/dist/library/index.esm.js.map +1 -0
  58. package/dist/library/library.esm.js +2 -0
  59. package/dist/library/library.esm.js.map +1 -0
  60. package/dist/library/p-65468fcf.entry.js +2 -0
  61. package/dist/library/p-65468fcf.entry.js.map +1 -0
  62. package/dist/library/p-b31186dc.js +3 -0
  63. package/dist/library/p-b31186dc.js.map +1 -0
  64. package/dist/library/p-f08d8e98.entry.js +2 -0
  65. package/dist/library/p-f08d8e98.entry.js.map +1 -0
  66. package/dist/types/components/ai12z-cta/ai12z-cta.d.ts +32 -0
  67. package/dist/types/components/ai12z-cta/components/Chat.d.ts +14 -0
  68. package/dist/types/components/ai12z-cta/components/Form.d.ts +1 -0
  69. package/dist/types/components/ai12z-cta/components/SearchResult.d.ts +1 -0
  70. package/dist/types/components/input/Input.d.ts +16 -0
  71. package/dist/types/components/spinner/Spinner.d.ts +4 -0
  72. package/dist/types/components.d.ts +130 -0
  73. package/dist/types/index.d.ts +1 -0
  74. package/dist/types/stencil-public-runtime.d.ts +1681 -0
  75. package/dist/types/utils/utils.d.ts +5 -0
  76. package/loader/cdn.js +3 -0
  77. package/loader/index.cjs.js +3 -0
  78. package/loader/index.d.ts +21 -0
  79. package/loader/index.es2017.js +3 -0
  80. package/loader/index.js +4 -0
  81. package/loader/package.json +11 -0
  82. package/package.json +42 -0
  83. package/readme.md +30 -0
@@ -0,0 +1,32 @@
1
+ import { h } from "@stencil/core";
2
+ import { debounce } from "../../../utils/utils";
3
+ let searchForm;
4
+ let searchInput;
5
+ let submitted = false;
6
+ export default function InputForm(props) {
7
+ const handleInputChange = e => {
8
+ if (props.isChat) {
9
+ return;
10
+ }
11
+ const value = searchInput.value;
12
+ if (value.length > 3) {
13
+ props.onsubmit(e, value, "search");
14
+ }
15
+ };
16
+ const handleFormSubmit = e => {
17
+ e.preventDefault();
18
+ if (searchInput.value.length > 3) {
19
+ props.onsubmit(e, searchInput.value, "search");
20
+ }
21
+ };
22
+ const handleAskAI = async (e) => {
23
+ e.preventDefault();
24
+ submitted = true;
25
+ await props.onsubmit(e, searchInput.value, "ask-ai");
26
+ submitted = false;
27
+ searchInput.value = "";
28
+ searchInput.focus();
29
+ };
30
+ return (h("form", { noValidate: true, onSubmit: e => handleFormSubmit(e), class: "" }, h("div", { ref: el => (searchForm = el), class: "relative flex items-center rounded rounded-md border border-grey-light items-stretch" }, h("div", { class: "flex-grow p-3" }, h("input", { readOnly: submitted, ref: el => (searchInput = el), required: true, type: "text", placeholder: props.placeholder, autoComplete: "off", class: "block w-full border-0 focus:ring-0 focus:outline-none", value: props.formData.search, onInput: debounce(e => handleInputChange(e), 500), onFocus: () => searchForm.classList.add("border-blue-500"), onBlur: () => searchForm.classList.remove("border-blue-500") })), h("button", { disabled: submitted, onClick: e => handleAskAI(e), class: "border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white" }, props.buttonText))));
31
+ }
32
+ //# sourceMappingURL=Form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../../src/components/ai12z-cta/components/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,IAAI,UAA0B,CAAA;AAC9B,IAAI,WAA6B,CAAA;AACjC,IAAI,SAAS,GAAY,KAAK,CAAA;AAE9B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAU;IAC1C,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE;QAC5B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,OAAM;QACR,CAAC;QACD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAA;QAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;QACpC,CAAC;IACH,CAAC,CAAA;IAED,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE;QAC3B,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;IACH,CAAC,CAAA;IAED,MAAM,WAAW,GAAG,KAAK,EAAC,CAAC,EAAC,EAAE;QAC5B,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,SAAS,GAAG,IAAI,CAAA;QAChB,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CA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HTMLInputElement\nlet submitted: boolean = false\n\nexport default function InputForm(props: any) {\n const handleInputChange = e => {\n if (props.isChat) {\n return\n }\n const value = searchInput.value\n if (value.length > 3) {\n props.onsubmit(e, value, \"search\")\n }\n }\n\n const handleFormSubmit = e => {\n e.preventDefault()\n if (searchInput.value.length > 3) {\n props.onsubmit(e, searchInput.value, \"search\")\n }\n }\n\n const handleAskAI = async e => {\n e.preventDefault()\n submitted = true\n await props.onsubmit(e, searchInput.value, \"ask-ai\")\n submitted = false\n searchInput.value = \"\"\n searchInput.focus()\n }\n\n return (\n <form noValidate onSubmit={e => handleFormSubmit(e)} class=\"\">\n <div ref={el => (searchForm = el)} class=\"relative flex items-center rounded rounded-md border border-grey-light items-stretch\">\n <div class=\"flex-grow p-3\">\n <input\n readOnly={submitted}\n ref={el => (searchInput = el as HTMLInputElement)}\n required\n type=\"text\"\n placeholder={props.placeholder}\n autoComplete=\"off\"\n class=\"block w-full border-0 focus:ring-0 focus:outline-none\"\n value={props.formData.search}\n onInput={debounce(e => handleInputChange(e), 500)}\n onFocus={() => searchForm.classList.add(\"border-blue-500\")}\n onBlur={() => searchForm.classList.remove(\"border-blue-500\")}\n />\n </div>\n <button disabled={submitted} onClick={e => handleAskAI(e)} class=\"border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white\">\n {props.buttonText}\n </button>\n </div>\n </form>\n )\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { h } from "@stencil/core";
2
+ export default function SearchResult(props) {
3
+ const results = props.results;
4
+ return (h("div", { class: "results" }, h("ul", { role: "list", class: "divide-y divide-gray-100" }, results === null || results === void 0 ? void 0 : results.map(result => {
5
+ return (h("li", { key: result.title, class: "relative py-5 hover:bg-gray-50" }, h("div", { class: "px-4 sm:px-6 lg:px-8" }, h("div", { class: "mx-auto flex max-w-4xl justify-between gap-x-6" }, h("div", { class: "flex min-w-0 gap-x-4" }, h("div", null, h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5" }))), h("div", { class: "min-w-0 flex-auto" }, h("p", { class: "text-sm font-semibold leading-6 text-gray-900" }, h("a", { href: result.link }, h("span", { class: "absolute inset-x-0 -top-px bottom-0" }), result.title)), h("p", { class: "mt-1 flex text-xs leading-5 text-gray-500" }, h("a", { href: result.link, class: "relative truncate hover:underline" }, result.description)))), h("div", { class: "flex shrink-0 items-center gap-x-4" }, h("svg", { class: "h-5 w-5 flex-none text-gray-400", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z", "clip-rule": "evenodd" })))))));
6
+ }))));
7
+ }
8
+ //# sourceMappingURL=SearchResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchResult.js","sourceRoot":"","sources":["../../../../src/components/ai12z-cta/components/SearchResult.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AACjC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAU;IAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;IAE7B,OAAO,CACL,WAAK,KAAK,EAAC,SAAS;QAClB,UAAI,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,0BAA0B,IAC7C,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,MAAM,CAAC,EAAE;YACrB,OAAO,CACL,UAAI,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAC,gCAAgC;gBAK3D,WAAK,KAAK,EAAC,sBAAsB;oBAC/B,WAAK,KAAK,EAAC,gDAAgD;wBACzD,WAAK,KAAK,EAAC,sBAAsB;4BAC/B;gCACE,WAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,kBAAc,KAAK,EAAC,MAAM,EAAC,cAAc,EAAC,KAAK,EAAC,SAAS;oCAC9H,8BAAqB,OAAO,qBAAiB,OAAO,EAAC,CAAC,EAAC,kEAAkE,GAAG,CACxH,CACF;4BACN,WAAK,KAAK,EAAC,mBAAmB;gCAC5B,SAAG,KAAK,EAAC,+CAA+C;oCACtD,SAAG,IAAI,EAAE,MAAM,CAAC,IAAI;wCAClB,YAAM,KAAK,EAAC,qCAAqC,GAAQ;wCACxD,MAAM,CAAC,KAAK,CACX,CACF;gCACJ,SAAG,KAAK,EAAC,2CAA2C;oCAClD,SAAG,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAC,mCAAmC,IAC5D,MAAM,CAAC,WAAW,CACjB,CACF,CACA,CACF;wBACN,WAAK,KAAK,EAAC,oCAAoC;4BAC7C,WAAK,KAAK,EAAC,iCAAiC,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,iBAAa,MAAM;gCACrG,yBACY,SAAS,EACnB,CAAC,EAAC,qIAAqI,eAC7H,SAAS,GACnB,CACE,CACF,CACF,CACF,CACH,CACN,CAAA;QACH,CAAC,CAAC,CACC,CACD,CACP,CAAA;AACH,CAAC","sourcesContent":["import { h } from \"@stencil/core\"\nexport default function SearchResult(props: any) {\n const results = props.results\n\n return (\n <div class=\"results\">\n <ul role=\"list\" class=\"divide-y divide-gray-100\">\n {results?.map(result => {\n return (\n <li key={result.title} class=\"relative py-5 hover:bg-gray-50\">\n {/* <div class=\"result\">\n <h2>{result.title}</h2>\n <p>{result.description}</p>\n </div> */}\n <div class=\"px-4 sm:px-6 lg:px-8\">\n <div class=\"mx-auto flex max-w-4xl justify-between gap-x-6\">\n <div class=\"flex min-w-0 gap-x-4\">\n <div>\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5\" />\n </svg>\n </div>\n <div class=\"min-w-0 flex-auto\">\n <p class=\"text-sm font-semibold leading-6 text-gray-900\">\n <a href={result.link}>\n <span class=\"absolute inset-x-0 -top-px bottom-0\"></span>\n {result.title}\n </a>\n </p>\n <p class=\"mt-1 flex text-xs leading-5 text-gray-500\">\n <a href={result.link} class=\"relative truncate hover:underline\">\n {result.description}\n </a>\n </p>\n </div>\n </div>\n <div class=\"flex shrink-0 items-center gap-x-4\">\n <svg class=\"h-5 w-5 flex-none text-gray-400\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\">\n <path\n fill-rule=\"evenodd\"\n d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\"\n clip-rule=\"evenodd\"\n />\n </svg>\n </div>\n </div>\n </div>\n </li>\n )\n })}\n </ul>\n </div>\n )\n}\n"]}
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.relative{position:relative}.right-0{right:0}.top-0{top:0}.mt-5{margin-top:1.25rem}.flex{display:flex}.h-16{height:4rem}.h-6{height:1.5rem}.h-8{height:2rem}.max-h-\[600px\]{max-height:600px}.w-16{width:4rem}.w-6{width:1.5rem}.w-8{width:2rem}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.bg-slate-100{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity))}.p-4{padding:1rem}.p-5{padding:1.25rem}.pe-10{padding-inline-end:2.5rem}.pr-2{padding-right:.5rem}.ps-20{padding-inline-start:5rem}.leading-7{line-height:1.75rem}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}
@@ -0,0 +1,130 @@
1
+ import { h } from "@stencil/core";
2
+ import { debounce } from "../../utils/utils";
3
+ export class InputForm {
4
+ constructor() {
5
+ this.handleInputChange = (e) => {
6
+ this.searchInput = this.searchInputElem.value;
7
+ if (this.isChat) {
8
+ return;
9
+ }
10
+ const value = this.searchInputElem.value;
11
+ if (value.length > 3) {
12
+ this.action.emit({ event: e, value: value, type: "search" });
13
+ }
14
+ };
15
+ this.handleFormSubmit = (e) => {
16
+ e.preventDefault();
17
+ if (this.searchInput.length > 3) {
18
+ this.action.emit({ event: e, value: this.searchInput, type: "search" });
19
+ }
20
+ };
21
+ this.handleAskAI = (e) => {
22
+ e.preventDefault();
23
+ this.submitted = true;
24
+ this.action.emit({ event: e, value: this.searchInput, type: "ask-ai" });
25
+ this.submitted = false;
26
+ this.searchInput = "";
27
+ };
28
+ this.isChat = undefined;
29
+ this.placeholder = undefined;
30
+ this.buttonText = undefined;
31
+ this.searchInput = "";
32
+ this.submitted = false;
33
+ }
34
+ render() {
35
+ return (h("form", { onSubmit: this.handleFormSubmit }, h("div", { ref: el => (this.searchFormElem = el), class: "relative flex items-center rounded rounded-md border border-grey-light items-stretch" }, h("div", { class: "flex-grow p-3" }, h("input", { readOnly: this.submitted, ref: el => (this.searchInputElem = el), required: true, type: "text", placeholder: this.placeholder, autoComplete: "off", class: "block w-full border-0 focus:ring-0 focus:outline-none", value: this.searchInput, onInput: debounce(e => this.handleInputChange(e), 500), onFocus: () => this.searchFormElem.classList.add("border-blue-500"), onBlur: () => this.searchFormElem.classList.remove("border-blue-500") })), h("button", { disabled: this.submitted, onClick: this.handleAskAI, class: "border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white" }, this.buttonText))));
36
+ }
37
+ static get is() { return "ai12z-input-form"; }
38
+ static get encapsulation() { return "shadow"; }
39
+ static get originalStyleUrls() {
40
+ return {
41
+ "$": ["./input.css"]
42
+ };
43
+ }
44
+ static get styleUrls() {
45
+ return {
46
+ "$": ["input.css"]
47
+ };
48
+ }
49
+ static get properties() {
50
+ return {
51
+ "isChat": {
52
+ "type": "boolean",
53
+ "mutable": false,
54
+ "complexType": {
55
+ "original": "boolean",
56
+ "resolved": "boolean",
57
+ "references": {}
58
+ },
59
+ "required": false,
60
+ "optional": false,
61
+ "docs": {
62
+ "tags": [],
63
+ "text": ""
64
+ },
65
+ "attribute": "is-chat",
66
+ "reflect": false
67
+ },
68
+ "placeholder": {
69
+ "type": "string",
70
+ "mutable": false,
71
+ "complexType": {
72
+ "original": "string",
73
+ "resolved": "string",
74
+ "references": {}
75
+ },
76
+ "required": false,
77
+ "optional": false,
78
+ "docs": {
79
+ "tags": [],
80
+ "text": ""
81
+ },
82
+ "attribute": "placeholder",
83
+ "reflect": false
84
+ },
85
+ "buttonText": {
86
+ "type": "string",
87
+ "mutable": false,
88
+ "complexType": {
89
+ "original": "string",
90
+ "resolved": "string",
91
+ "references": {}
92
+ },
93
+ "required": false,
94
+ "optional": false,
95
+ "docs": {
96
+ "tags": [],
97
+ "text": ""
98
+ },
99
+ "attribute": "button-text",
100
+ "reflect": false
101
+ }
102
+ };
103
+ }
104
+ static get states() {
105
+ return {
106
+ "searchInput": {},
107
+ "submitted": {}
108
+ };
109
+ }
110
+ static get events() {
111
+ return [{
112
+ "method": "action",
113
+ "name": "action",
114
+ "bubbles": true,
115
+ "cancelable": true,
116
+ "composed": true,
117
+ "docs": {
118
+ "tags": [],
119
+ "text": ""
120
+ },
121
+ "complexType": {
122
+ "original": "any",
123
+ "resolved": "any",
124
+ "references": {}
125
+ }
126
+ }];
127
+ }
128
+ static get elementRef() { return "el"; }
129
+ }
130
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,OAAO,EAAE,MAAM,eAAe,CAAA;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAO5C,MAAM,OAAO,SAAS;;QAepB,sBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAA;YAC7C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,OAAM;YACR,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAA;YACxC,IAAI,KAAK,CAAC,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AAI,CAAC,eAAe,GAAG,EAAsB,CAAC,EAC1D,QAAQ,QACR,IAAI,EAAC,MAAM,EACX,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,YAAY,EAAC,KAAK,EAClB,KAAK,EAAC,uDAAuD,EAC7D,KAAK,EAAE,IAAI,CAAC,WAAW,EACvB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EACtD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,EACnE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,GACrE,CACE;gBACN,cAAQ,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAC,sEAAsE,IACtI,IAAI,CAAC,UAAU,CACT,CACL,CASD,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Event, EventEmitter, Element } from \"@stencil/core\"\nimport { debounce } from \"../../utils/utils\"\n\n@Component({\n tag: \"ai12z-input-form\",\n styleUrl: \"./input.css\",\n shadow: true,\n})\nexport class InputForm {\n private searchFormElem: HTMLDivElement\n private searchInputElem: HTMLInputElement\n\n @Element() el!: HTMLElement\n\n @Prop() isChat: boolean\n @Prop() placeholder: string\n @Prop() buttonText: string\n\n @Event() action: EventEmitter\n\n @State() searchInput: string = \"\"\n @State() submitted: boolean = false\n\n handleInputChange = (e: Event) => {\n this.searchInput = this.searchInputElem.value\n if (this.isChat) {\n return\n }\n const value = this.searchInputElem.value\n if (value.length > 3) {\n this.action.emit({ event: e, value: value, type: \"search\" })\n }\n }\n\n handleFormSubmit = (e: Event) => {\n e.preventDefault()\n if (this.searchInput.length > 3) {\n this.action.emit({ event: e, value: this.searchInput, type: \"search\" })\n }\n }\n\n handleAskAI = (e: Event) => {\n e.preventDefault()\n this.submitted = true\n this.action.emit({ event: e, value: this.searchInput, type: \"ask-ai\" })\n this.submitted = false\n this.searchInput = \"\"\n }\n\n render() {\n return (\n <form onSubmit={this.handleFormSubmit}>\n <div ref={el => (this.searchFormElem = el)} class=\"relative flex items-center rounded rounded-md border border-grey-light items-stretch\">\n <div class=\"flex-grow p-3\">\n <input\n readOnly={this.submitted}\n ref={el => (this.searchInputElem = el as HTMLInputElement)}\n required\n type=\"text\"\n placeholder={this.placeholder}\n autoComplete=\"off\"\n class=\"block w-full border-0 focus:ring-0 focus:outline-none\"\n value={this.searchInput}\n onInput={debounce(e => this.handleInputChange(e), 500)}\n onFocus={() => this.searchFormElem.classList.add(\"border-blue-500\")}\n onBlur={() => this.searchFormElem.classList.remove(\"border-blue-500\")}\n />\n </div>\n <button disabled={this.submitted} onClick={this.handleAskAI} class=\"border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white\">\n {this.buttonText}\n </button>\n </div>\n {/* <div ref={el => (this.searchForm = el)} class=\"relative flex items-center rounded rounded-md border border-grey-light items-stretch\">\n <div class=\"flex-grow p-3\">\n <input type=\"text\" onInput={this.handleInputChange} value={this.searchInput} placeholder={this.placeholder} />\n </div>\n <button onClick={this.handleAskAI} class=\"border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white\">\n {this.buttonText}\n </button>\n </div> */}\n </form>\n )\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.flex,.input-form{display:flex}.input-form{flex-direction:column;margin-bottom:1rem;width:100%}.relative{position:relative}.block{display:block}.flex{display:flex}.w-full{width:100%}.flex-grow{flex-grow:1}.items-center{align-items:center}.items-stretch{align-items:stretch}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-l{border-left-width:1px}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity))}.p-3{padding:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.hover\:bg-indigo-300:hover{--tw-bg-opacity:1;background-color:rgb(165 180 252/var(--tw-bg-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}
@@ -0,0 +1,44 @@
1
+ import { h } from "@stencil/core";
2
+ export class Spinner {
3
+ constructor() {
4
+ this.class = "w-6 h-6";
5
+ }
6
+ render() {
7
+ return h("div", { class: "loader " + this.class });
8
+ }
9
+ static get is() { return "ai12z-spinner"; }
10
+ static get encapsulation() { return "shadow"; }
11
+ static get originalStyleUrls() {
12
+ return {
13
+ "$": ["./spinner.css"]
14
+ };
15
+ }
16
+ static get styleUrls() {
17
+ return {
18
+ "$": ["spinner.css"]
19
+ };
20
+ }
21
+ static get properties() {
22
+ return {
23
+ "class": {
24
+ "type": "string",
25
+ "mutable": false,
26
+ "complexType": {
27
+ "original": "string",
28
+ "resolved": "string",
29
+ "references": {}
30
+ },
31
+ "required": false,
32
+ "optional": false,
33
+ "docs": {
34
+ "tags": [],
35
+ "text": ""
36
+ },
37
+ "attribute": "class",
38
+ "reflect": false,
39
+ "defaultValue": "\"w-6 h-6\""
40
+ }
41
+ };
42
+ }
43
+ }
44
+ //# sourceMappingURL=Spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../src/components/spinner/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAOlD,MAAM,OAAO,OAAO;;qBACM,SAAS;;IAEjC,MAAM;QACJ,OAAO,WAAK,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC,KAAK,GAAQ,CAAA;IACnD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from \"@stencil/core\"\n\n@Component({\n tag: \"ai12z-spinner\",\n styleUrl: \"./spinner.css\",\n shadow: true,\n})\nexport class Spinner {\n @Prop() class: string = \"w-6 h-6\"\n\n render() {\n return <div class={\"loader \" + this.class}></div>\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.border{border-width:1px}.loader{animation:spin 2s linear infinite;border:16px solid #f3f3f3;border-radius:75%;border-top-color:#3498db;height:120px;width:120px}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.h-6{height:1.5rem}.w-6{width:1.5rem}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from './components';\n"]}
@@ -0,0 +1,86 @@
1
+ function getEndpoint(env) {
2
+ switch (env) {
3
+ case "local":
4
+ return `http://127.0.0.1:5000/api`;
5
+ case "dev":
6
+ return `https://dev-api.ai12z.net/api`;
7
+ case "prod":
8
+ return `https://api.ai12z.net/api`;
9
+ default:
10
+ return `https://api.ai12z.net/api`;
11
+ }
12
+ }
13
+ async function apiFetch(url, payload) {
14
+ var _a, _b;
15
+ try {
16
+ const meta = {
17
+ origin: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin,
18
+ title: document === null || document === void 0 ? void 0 : document.title,
19
+ userAgent: navigator === null || navigator === void 0 ? void 0 : navigator.userAgent,
20
+ referrer: document === null || document === void 0 ? void 0 : document.referrer,
21
+ language: navigator === null || navigator === void 0 ? void 0 : navigator.language,
22
+ description: (_b = document.querySelector('meta[name="description"]')) === null || _b === void 0 ? void 0 : _b.getAttribute("content"),
23
+ };
24
+ payload = Object.assign(Object.assign({}, payload), { meta });
25
+ const response = await fetch(url, {
26
+ method: "POST",
27
+ headers: {
28
+ "Content-Type": "application/json",
29
+ },
30
+ body: JSON.stringify(payload),
31
+ });
32
+ if (!response.ok) {
33
+ throw new Error(`HTTP error! status: ${response.status}`);
34
+ }
35
+ const jsonResponse = await response.json();
36
+ return await jsonResponse;
37
+ }
38
+ catch (error) {
39
+ throw error;
40
+ }
41
+ }
42
+ export function format(first, middle, last) {
43
+ return (first || "") + (middle ? ` ${middle}` : "") + (last ? ` ${last}` : "");
44
+ }
45
+ export async function search(apiKey, env, terms) {
46
+ if (!terms)
47
+ return [];
48
+ if (!apiKey)
49
+ throw new Error(`Public Key is required. Please provide using attribute "data-key".`);
50
+ const endpoint = `${getEndpoint(env)}/search`;
51
+ const data = {
52
+ apiKey,
53
+ query: terms,
54
+ num_docs: 4,
55
+ };
56
+ return await apiFetch(endpoint, data);
57
+ }
58
+ export async function askAI(apiKey, env, question, conversationId) {
59
+ const endpoint = `${getEndpoint(env)}/askai`;
60
+ const data = {
61
+ apiKey,
62
+ query: question,
63
+ conversation_id: conversationId,
64
+ format: "html",
65
+ };
66
+ return await apiFetch(endpoint, data);
67
+ }
68
+ export async function sendFeedback(apiKey, env, insightId, feedback) {
69
+ const endpoint = `${getEndpoint(env)}/feedback`;
70
+ const data = {
71
+ apiKey,
72
+ insight_id: insightId,
73
+ feedback,
74
+ };
75
+ return await apiFetch(endpoint, data);
76
+ }
77
+ export function debounce(func, timeout = 300) {
78
+ let timer;
79
+ return (...args) => {
80
+ clearTimeout(timer);
81
+ timer = setTimeout(() => {
82
+ func.apply(this, args);
83
+ }, timeout);
84
+ };
85
+ }
86
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAW;IAC9B,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,2BAA2B,CAAA;QACpC,KAAK,KAAK;YACR,OAAO,+BAA+B,CAAA;QACxC,KAAK,MAAM;YACT,OAAO,2BAA2B,CAAA;QACpC;YACE,OAAO,2BAA2B,CAAA;IACtC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,OAAY;;IAC/C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,0CAAE,MAAM;YAChC,KAAK,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK;YACtB,SAAS,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS;YAC/B,QAAQ,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ;YAC5B,QAAQ,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ;YAC7B,WAAW,EAAE,MAAA,QAAQ,CAAC,aAAa,CAAC,0BAA0B,CAAC,0CAAE,YAAY,CAAC,SAAS,CAAC;SACzF,CAAA;QACD,OAAO,mCAAQ,OAAO,KAAE,IAAI,GAAE,CAAA;QAC9B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,C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I,GAAG;QACX,MAAM;QACN,KAAK,EAAE,QAAQ;QACf,eAAe,EAAE,cAAc;QAC/B,MAAM,EAAE,MAAM;KACf,CAAA;IAED,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAc,EAAE,GAAW,EAAE,SAAiB,EAAE,QAAgB;IACjG,MAAM,QAAQ,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,WAAW,CAAA;IAC/C,MAAM,IAAI,GAAG;QACX,MAAM;QACN,UAAU,EAAE,SAAS;QACrB,QAAQ;KACT,CAAA;IAED,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG;IAC1C,IAAI,KAAK,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;QACjB,YAAY,CAAC,KAAK,CAAC,CAAA;QACnB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACxB,CAAC,EAAE,OAAO,CAAC,CAAA;IACb,CAAC,CAAA;AACH,CAAC","sourcesContent":["function getEndpoint(env: string) {\n switch (env) {\n case \"local\":\n return `http://127.0.0.1:5000/api`\n case \"dev\":\n return `https://dev-api.ai12z.net/api`\n case \"prod\":\n return `https://api.ai12z.net/api`\n default:\n return `https://api.ai12z.net/api`\n }\n}\n\nasync function apiFetch(url: string, payload: any) {\n try {\n const meta = {\n origin: window?.location?.origin,\n title: document?.title,\n userAgent: navigator?.userAgent,\n referrer: document?.referrer,\n language: navigator?.language,\n description: document.querySelector('meta[name=\"description\"]')?.getAttribute(\"content\"),\n }\n payload = { ...payload, meta }\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n })\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const jsonResponse = await response.json()\n\n return await jsonResponse\n } catch (error) {\n throw error\n }\n}\n\nexport function format(first: string, middle: string, last: string): string {\n return (first || \"\") + (middle ? ` ${middle}` : \"\") + (last ? ` ${last}` : \"\")\n}\n\nexport async function search(apiKey: string, env: string, terms: string) {\n if (!terms) return []\n if (!apiKey) throw new Error(`Public Key is required. Please provide using attribute \"data-key\".`)\n const endpoint = `${getEndpoint(env)}/search`\n const data = {\n apiKey,\n query: terms,\n num_docs: 4,\n }\n return await apiFetch(endpoint, data)\n}\n\nexport async function askAI(apiKey: string, env: string, question: string, conversationId: string) {\n const endpoint = `${getEndpoint(env)}/askai`\n const data = {\n apiKey,\n query: question,\n conversation_id: conversationId,\n format: \"html\",\n }\n\n return await apiFetch(endpoint, data)\n}\n\nexport async function sendFeedback(apiKey: string, env: string, insightId: string, feedback: 1 | -1) {\n const endpoint = `${getEndpoint(env)}/feedback`\n const data = {\n apiKey,\n insight_id: insightId,\n feedback,\n }\n\n return await apiFetch(endpoint, data)\n}\n\nexport function debounce(func, timeout = 300) {\n let timer\n return (...args) => {\n clearTimeout(timer)\n timer = setTimeout(() => {\n func.apply(this, args)\n }, timeout)\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { format } from "./utils";
2
+ describe('format', () => {
3
+ it('returns empty string for no names defined', () => {
4
+ expect(format(undefined, undefined, undefined)).toEqual('');
5
+ });
6
+ it('formats just first names', () => {
7
+ expect(format('Joseph', undefined, undefined)).toEqual('Joseph');
8
+ });
9
+ it('formats first and last names', () => {
10
+ expect(format('Joseph', undefined, 'Publique')).toEqual('Joseph Publique');
11
+ });
12
+ it('formats first, middle and last names', () => {
13
+ expect(format('Joseph', 'Quincy', 'Publique')).toEqual('Joseph Quincy Publique');
14
+ });
15
+ });
16
+ //# sourceMappingURL=utils.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../src/utils/utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { format } from './utils';\n\ndescribe('format', () => {\n it('returns empty string for no names defined', () => {\n expect(format(undefined, undefined, undefined)).toEqual('');\n });\n\n it('formats just first names', () => {\n expect(format('Joseph', undefined, undefined)).toEqual('Joseph');\n });\n\n it('formats first and last names', () => {\n expect(format('Joseph', undefined, 'Publique')).toEqual('Joseph Publique');\n });\n\n it('formats first, middle and last names', () => {\n expect(format('Joseph', 'Quincy', 'Publique')).toEqual('Joseph Quincy Publique');\n });\n});\n"]}