@pickaxeproject/react 1.4.6 → 2.0.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 (159) hide show
  1. package/dist/cjs/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
  2. package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
  3. package/dist/cjs/components/Pickaxe/Chat/History/index.js +1 -1
  4. package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
  5. package/dist/cjs/components/Pickaxe/Form/History/Item.js +1 -1
  6. package/dist/cjs/components/Pickaxe/Form/History/Response.js +1 -1
  7. package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
  8. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/A/Html/HtmlModal.js +1 -0
  9. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.js +1 -0
  10. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Action/index.js +1 -0
  11. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Code/index.js +1 -0
  12. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Headings/index.js +1 -0
  13. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Iframe/index.js +1 -0
  14. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Img/index.js +1 -0
  15. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/List/index.js +1 -0
  16. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Others/index.js +1 -0
  17. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.js +1 -0
  18. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Table/index.js +1 -0
  19. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  20. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/index.js +1 -1
  21. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.js +1 -0
  22. package/dist/cjs/components/Pickaxe/index.js +1 -1
  23. package/dist/cjs/hooks/pickaxe/usePickaxe.js +1 -1
  24. package/dist/cjs/hooks/pickaxe/useSubmit.js +1 -1
  25. package/dist/cjs/index.js +1 -1
  26. package/dist/cjs/prose.css +1 -1
  27. package/dist/cjs/src/common/documents.d.ts +0 -2
  28. package/dist/cjs/src/components/Pickaxe/Provider.d.ts +3 -3
  29. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.d.ts +2 -0
  30. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Action/index.d.ts +4 -0
  31. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Code/index.d.ts +2 -0
  32. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Headings/index.d.ts +6 -0
  33. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Iframe/index.d.ts +2 -0
  34. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Img/index.d.ts +2 -0
  35. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/List/index.d.ts +4 -0
  36. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Others/index.d.ts +4 -0
  37. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.d.ts +2 -0
  38. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Table/index.d.ts +5 -0
  39. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Renderer.d.ts +4 -7
  40. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts +2 -4
  41. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/index.d.ts +14 -12
  42. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.d.ts +1 -0
  43. package/dist/cjs/src/hooks/pickaxe/usePickaxe.d.ts +2 -7
  44. package/dist/cjs/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -2
  45. package/dist/cjs/src/hooks/pickaxe/useSubmit.d.ts +1 -16
  46. package/dist/cjs/src/index.d.ts +0 -1
  47. package/dist/cjs/src/types/form.d.ts +2 -6
  48. package/dist/cjs/src/types/pickaxe.d.ts +21 -3
  49. package/dist/esm/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
  50. package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
  51. package/dist/esm/components/Pickaxe/Chat/History/index.js +1 -1
  52. package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
  53. package/dist/esm/components/Pickaxe/Form/History/Item.js +1 -1
  54. package/dist/esm/components/Pickaxe/Form/History/Response.js +1 -1
  55. package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
  56. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/A/Html/HtmlModal.js +1 -0
  57. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.js +1 -0
  58. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Action/index.js +1 -0
  59. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Code/index.js +1 -0
  60. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Headings/index.js +1 -0
  61. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Iframe/index.js +1 -0
  62. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Img/index.js +1 -0
  63. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/List/index.js +1 -0
  64. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Others/index.js +1 -0
  65. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.js +1 -0
  66. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Table/index.js +1 -0
  67. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  68. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/index.js +1 -1
  69. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.js +1 -0
  70. package/dist/esm/components/Pickaxe/index.js +1 -1
  71. package/dist/esm/hooks/pickaxe/usePickaxe.js +1 -1
  72. package/dist/esm/hooks/pickaxe/useSubmit.js +1 -1
  73. package/dist/esm/index.js +1 -1
  74. package/dist/esm/prose.css +1 -1
  75. package/dist/esm/src/common/documents.d.ts +0 -2
  76. package/dist/esm/src/components/Pickaxe/Provider.d.ts +3 -3
  77. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.d.ts +2 -0
  78. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Action/index.d.ts +4 -0
  79. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Code/index.d.ts +2 -0
  80. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Headings/index.d.ts +6 -0
  81. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Iframe/index.d.ts +2 -0
  82. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Img/index.d.ts +2 -0
  83. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/List/index.d.ts +4 -0
  84. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Others/index.d.ts +4 -0
  85. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.d.ts +2 -0
  86. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Table/index.d.ts +5 -0
  87. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Renderer.d.ts +4 -7
  88. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts +2 -4
  89. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/index.d.ts +14 -12
  90. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.d.ts +1 -0
  91. package/dist/esm/src/hooks/pickaxe/usePickaxe.d.ts +2 -7
  92. package/dist/esm/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -2
  93. package/dist/esm/src/hooks/pickaxe/useSubmit.d.ts +1 -16
  94. package/dist/esm/src/index.d.ts +0 -1
  95. package/dist/esm/src/types/form.d.ts +2 -6
  96. package/dist/esm/src/types/pickaxe.d.ts +21 -3
  97. package/package.json +4 -1
  98. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +0 -1
  99. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.js +0 -1
  100. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.js +0 -1
  101. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +0 -1
  102. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +0 -1
  103. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/common/Html/HtmlModal.js +0 -1
  104. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/common/LinkPreview.js +0 -1
  105. package/dist/cjs/hooks/pickaxe/useSubmitResult.js +0 -1
  106. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.d.ts +0 -4
  107. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.d.ts +0 -6
  108. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.d.ts +0 -4
  109. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.d.ts +0 -4
  110. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.d.ts +0 -4
  111. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/common/LinkPreview.d.ts +0 -6
  112. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/common/TextModal.d.ts +0 -7
  113. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/utils/clamp.d.ts +0 -2
  114. package/dist/cjs/src/hooks/pickaxe/useSubmitResult.d.ts +0 -30
  115. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +0 -1
  116. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.js +0 -1
  117. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.js +0 -1
  118. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +0 -1
  119. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +0 -1
  120. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/common/Html/HtmlModal.js +0 -1
  121. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/common/LinkPreview.js +0 -1
  122. package/dist/esm/hooks/pickaxe/useSubmitResult.js +0 -1
  123. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.d.ts +0 -4
  124. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.d.ts +0 -6
  125. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.d.ts +0 -4
  126. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.d.ts +0 -4
  127. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.d.ts +0 -4
  128. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/common/LinkPreview.d.ts +0 -6
  129. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/common/TextModal.d.ts +0 -7
  130. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/utils/clamp.d.ts +0 -2
  131. package/dist/esm/src/hooks/pickaxe/useSubmitResult.d.ts +0 -30
  132. /package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Audio.js +0 -0
  133. /package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Html/index.js +0 -0
  134. /package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/Img/ImgModal.js +0 -0
  135. /package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Action.js +0 -0
  136. /package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/Body.js +0 -0
  137. /package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/index.js +0 -0
  138. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Audio.d.ts +0 -0
  139. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Html/HtmlModal.d.ts +0 -0
  140. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Html/index.d.ts +0 -0
  141. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/Img/ImgModal.d.ts +0 -0
  142. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Action.d.ts +0 -0
  143. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/Body.d.ts +0 -0
  144. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/CloseButton.d.ts +0 -0
  145. /package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/index.d.ts +0 -0
  146. /package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Audio.js +0 -0
  147. /package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Html/index.js +0 -0
  148. /package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/Img/ImgModal.js +0 -0
  149. /package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Action.js +0 -0
  150. /package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/Body.js +0 -0
  151. /package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/index.js +0 -0
  152. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Audio.d.ts +0 -0
  153. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Html/HtmlModal.d.ts +0 -0
  154. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom/common → Components/A}/Html/index.d.ts +0 -0
  155. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/Img/ImgModal.d.ts +0 -0
  156. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Action.d.ts +0 -0
  157. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/Body.d.ts +0 -0
  158. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/CloseButton.d.ts +0 -0
  159. /package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/{Custom → Components}/common/Modal/index.d.ts +0 -0
@@ -1,24 +1,27 @@
1
1
  import type { SetState } from "../../../../types/common";
2
- import { type CSSProperties, type ReactNode } from "react";
2
+ import type { FC, ComponentPropsWithoutRef, ElementType, ReactNode, CSSProperties } from "react";
3
+ import type { Element as HastElement } from "hast";
3
4
  export type PickaxeMarkdownTheme = "light" | "dark";
4
- export type WebsiteMetadata = {
5
- title: string;
6
- description: string;
7
- image: string;
8
- href: string;
5
+ export type MarkdownComponentProps<T extends ElementType> = ComponentPropsWithoutRef<T> & {
6
+ node?: HastElement;
9
7
  };
8
+ export type MarkdownComponent<T extends ElementType> = FC<MarkdownComponentProps<T>>;
9
+ export type CustomMarkdownComponentProps = {
10
+ children?: ReactNode;
11
+ node?: HastElement;
12
+ };
13
+ export type CustomMarkdownComponent = FC<CustomMarkdownComponentProps>;
14
+ export type ActionState = "processing" | "done" | "error";
10
15
  type PickaxeMarkdownContextType = {
11
16
  theme: PickaxeMarkdownTheme;
12
17
  syntaxTheme: Record<string, CSSProperties>;
13
18
  accentColor: string;
14
19
  accentTextColor: string;
15
- websiteMetadatas: WebsiteMetadata[];
16
- linkPreviews: boolean;
20
+ actionState: Record<string, ActionState>;
17
21
  actions: boolean;
18
22
  readOnly: boolean;
19
23
  setTheme: SetState<PickaxeMarkdownTheme>;
20
- setWebsiteMetadatas: SetState<WebsiteMetadata[]>;
21
- setLinkPreviews: SetState<boolean>;
24
+ setActionState: SetState<Record<string, ActionState>>;
22
25
  setActions: SetState<boolean>;
23
26
  };
24
27
  export interface PickaxeMarkdownProps {
@@ -27,10 +30,9 @@ export interface PickaxeMarkdownProps {
27
30
  syntaxTheme?: Record<string, CSSProperties>;
28
31
  accentColor?: string;
29
32
  accentTextColor?: string;
30
- linkPreviews?: boolean;
31
33
  actions?: boolean;
32
34
  readOnly?: boolean;
33
35
  }
34
36
  export declare const PickaxeMarkdownContext: import("react").Context<PickaxeMarkdownContextType>;
35
- export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor, accentTextColor, linkPreviews: _linkPreviews, actions: _actions, readOnly, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor, accentTextColor, actions: _actions, readOnly, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
36
38
  export default PickaxeMarkdown;
@@ -0,0 +1 @@
1
+ export declare const rehypePickaxeAction: () => (tree: any) => any;
@@ -1,7 +1,2 @@
1
- import type { Pickaxe } from "../../types/pickaxe";
2
- export type QueryResponse = {
3
- success: boolean;
4
- pickaxe: Pickaxe;
5
- error?: string;
6
- };
7
- export declare const usePickaxe: () => import("@tanstack/react-query").UseQueryResult<Pickaxe | null, Error>;
1
+ import type { LimitedPickaxe } from "../../types/pickaxe";
2
+ export declare const usePickaxe: () => import("@tanstack/react-query").UseQueryResult<LimitedPickaxe | null, Error>;
@@ -5,7 +5,7 @@ export declare const usePickaxeContext: () => {
5
5
  studioUserId: string;
6
6
  deploymentId: string;
7
7
  embedUserId: string;
8
- pickaxe: import("../../types/pickaxe").Pickaxe | null;
8
+ pickaxe: import("../../types/pickaxe").LimitedPickaxe | null;
9
9
  styles: import("../../components/Pickaxe/Provider").PickaxeProviderStyles;
10
10
  colors: import("../../components/Pickaxe/Provider").PickaxeProviderColors;
11
11
  misc: import("../../components/Pickaxe/Provider").PickaxeMisc;
@@ -21,7 +21,7 @@ export declare const usePickaxeContext: () => {
21
21
  isEmbed: boolean;
22
22
  setFormId: import("../../types/common").SetState<string>;
23
23
  setChatId: import("../../types/common").SetState<string>;
24
- setPickaxe: import("../../types/common").SetState<import("../../types/pickaxe").Pickaxe | null>;
24
+ setPickaxe: import("../../types/common").SetState<import("../../types/pickaxe").LimitedPickaxe | null>;
25
25
  setIsFontLoaded: import("../../types/common").SetState<boolean>;
26
26
  setIsNewChat: import("../../types/common").SetState<boolean>;
27
27
  setIsShowIceBreaker: import("../../types/common").SetState<boolean>;
@@ -10,20 +10,5 @@ type MutationParams = {
10
10
  value?: string;
11
11
  valueObj?: Record<string, string>;
12
12
  };
13
- type MutationResponse = {
14
- success: boolean;
15
- data: string;
16
- actionData: string;
17
- responseId: string;
18
- usedDocumentIds: string[];
19
- newDocumentId: string;
20
- newDocumentName: string;
21
- endUserDocumentId: string | null;
22
- endUserImageId: string | null;
23
- rawUserInput: string;
24
- isInsertedFile: boolean;
25
- isCountedAsOwnerUse: boolean;
26
- error?: string;
27
- };
28
- export declare const useSubmit: () => import("@tanstack/react-query").UseMutationResult<MutationResponse, Error, MutationParams, unknown>;
13
+ export declare const useSubmit: () => import("@tanstack/react-query").UseMutationResult<Response, Error, MutationParams, unknown>;
29
14
  export {};
@@ -11,4 +11,3 @@ export * from "./hooks/pickaxe/usePickaxeContext";
11
11
  export * from "./hooks/pickaxe/useResponseContext";
12
12
  export * from "./hooks/pickaxe/useSubmit";
13
13
  export * from "./hooks/pickaxe/useSubmitDocument";
14
- export * from "./hooks/pickaxe/useSubmitResult";
@@ -1,7 +1,6 @@
1
- import type { MemoryStoredChatMessage } from "./chat";
2
1
  import type { PickaxeHistoryQuestion } from "./history";
3
2
  export type PickaxeQuestionType = "Short Answer" | "short" | "Long Answer" | "long" | "Multiple Choice" | "multiple" | "Checkbox" | "Knowledge Upload";
4
- export type CachedPickaxeQuestion = {
3
+ export type PickaxeQuestion = {
5
4
  id: string;
6
5
  answerlength: string;
7
6
  example: string;
@@ -28,10 +27,7 @@ export type MemoryStoredResponse = {
28
27
  formId: string;
29
28
  responseId: string;
30
29
  documentIds: string[];
31
- messages: MemoryStoredChatMessage[];
32
30
  questions: PickaxeHistoryQuestion[];
33
- questionPrompt: string;
34
31
  questionResponse: string;
35
- userId?: string;
36
- createdAt: Date;
32
+ sentAt: Date;
37
33
  };
@@ -1,9 +1,9 @@
1
- import type { CachedPickaxeQuestion } from "./form";
1
+ import type { PickaxeQuestion } from "./form";
2
2
  export type PickaxeImageOrText = "text" | "image";
3
3
  export type PickaxePrivacySetting = "public" | "unlisted" | "private" | "deleted";
4
4
  export type PickaxeCloneable = "true" | "false";
5
5
  export type PickaxeDocumentUploadType = "ownerupload" | "enduserupload";
6
- export type PickaxeModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4-1106-preview" | "gpt-4" | "gpt-3.5-turbo" | "gpt-4.5-preview" | "o1" | "o3-mini" | "deepseek-chat" | "mistral-small" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620" | "claude-3-7-sonnet-20250219" | "llama-3-uncensored";
6
+ export type PickaxeModel = "gpt-3.5-turbo" | "gpt-4-1106-preview" | "mistral-small" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o-mini" | "gpt-4o" | "gpt-4" | "o3-mini" | "o1" | "deepseek-chat" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620" | "claude-3-7-sonnet-20250219" | "llama-3-uncensored";
7
7
  export type Pickaxe = {
8
8
  _id: string;
9
9
  formid: string;
@@ -54,5 +54,23 @@ export type Pickaxe = {
54
54
  usestotal: number;
55
55
  useslimit: number;
56
56
  timestamp: number;
57
- _questions?: CachedPickaxeQuestion[];
57
+ _questions?: PickaxeQuestion[];
58
+ };
59
+ export type LimitedPickaxe = {
60
+ formid: string;
61
+ workspaceid?: string;
62
+ studioid?: string;
63
+ coverphoto: string;
64
+ chatflag: boolean;
65
+ chatinputlength: number;
66
+ chaticon: string;
67
+ documentuploadtype: PickaxeDocumentUploadType;
68
+ enablechatresponses: boolean;
69
+ formdescription: string;
70
+ formtitle: string;
71
+ model: PickaxeModel;
72
+ placeholdertext: string;
73
+ icebreakers: string[];
74
+ submittext?: string;
75
+ _questions?: PickaxeQuestion[];
58
76
  };
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitDocument as s}from"../../../../../hooks/pickaxe/useSubmitDocument.js";import{useDocumentContext as n}from"./useDocumentContext.js";import{allowedFileMimeTypes as i,allowedImageMimeTypes as r}from"../../../../../common/documents.js";import a from"../../../../../common/error.js";const d=["gpt-4o-mini","gpt-4o","gpt-4.5-preview","o1"],u=({onQuestionChange:u}={})=>{const{formId:l,chatId:m,pickaxe:c}=o(),p=n(),f=s(),h=t((()=>{var e;return d.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},p),{isImageUploadAllowed:h,onFileUpload:t=>e(void 0,void 0,void 0,(function*(){if(p.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i,...h?r:[]],s=t.some((e=>!o.includes(e.type)));if(s){throw new Error(h?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}p.setIsUploading(!0),p.setIsShowList(!0),p.setDocuments([{type:"document",id:e.name,size:e.size,name:e.name,status:"uploading"}]);const n=yield f.document({formId:l,responseId:m,file:e}),{success:a,documentId:d,error:c}=n;if(!a)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:d});const y=d.startsWith("IMAGE-")?"image":"document";p.setDocuments([{type:y,id:e.name,size:e.size,name:e.name,status:"finished",documentId:d}]);return{type:y,size:e.size,id:e.name,name:e.name,status:"finished",documentId:d}}catch(t){const o=a(t);if(console.log("[onFileUpload] Error",o),o.includes("You can only upload"))return p.setDocumentError(o),null;p.editDocument({type:"document",id:e.name,name:e.name,size:e.size,status:"failed",error:o});return{type:"document",size:e.size,id:e.name,name:e.name,status:"failed",error:o}}finally{p.setIsUploading(!1)}})),onWebsiteUpload:t=>e(void 0,void 0,void 0,(function*(){p.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");p.setIsUploading(!0),p.setIsShowList(!0),p.setWebsiteLink(""),p.setDocuments([{type:"website",id:e,size:0,name:e,status:"uploading"}]);const t=yield f.website({formId:l,responseId:m,website:e}),{success:o,documentId:s}=t;if(!o)throw new Error("Website processing failed, please try again.");p.setDocuments([{type:"website",id:e,size:0,name:e,status:"finished",documentId:s}]);return{type:"website",id:e,name:e,size:0,status:"finished",documentId:s}}catch(t){const o=a(t);if(console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL"))return p.setDocumentError(o),null;p.editDocument({type:"website",id:e,size:0,name:e,status:"failed",error:o});return{type:"website",id:e,size:0,name:e,status:"failed",error:o}}finally{p.setIsUploading(!1)}})),onEditDocumentByDocId:p.editDocumentByDocId})};export{u as useDocument};
1
+ import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitDocument as s}from"../../../../../hooks/pickaxe/useSubmitDocument.js";import{useDocumentContext as n}from"./useDocumentContext.js";import{allowedFileMimeTypes as i,allowedImageMimeTypes as r}from"../../../../../common/documents.js";import a from"../../../../../common/error.js";const d=["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","o1"],u=({onQuestionChange:u}={})=>{const{formId:m,chatId:l,pickaxe:c}=o(),p=n(),f=s(),g=t((()=>{var e;return d.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},p),{isImageUploadAllowed:g,onFileUpload:t=>e(void 0,void 0,void 0,(function*(){if(p.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i,...g?r:[]],s=t.some((e=>!o.includes(e.type)));if(s){throw new Error(g?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}p.setIsUploading(!0),p.setIsShowList(!0),p.setDocuments([{type:"document",id:e.name,size:e.size,name:e.name,status:"uploading"}]);const n=yield f.document({formId:m,responseId:l,file:e}),{success:a,documentId:d,error:c}=n;if(!a)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:d});const h=d.startsWith("IMAGE-")?"image":"document";p.setDocuments([{type:h,id:e.name,size:e.size,name:e.name,status:"finished",documentId:d}]);return{type:h,size:e.size,id:e.name,name:e.name,status:"finished",documentId:d}}catch(t){const o=a(t);if(console.log("[onFileUpload] Error",o),o.includes("You can only upload"))return p.setDocumentError(o),null;p.editDocument({type:"document",id:e.name,name:e.name,size:e.size,status:"failed",error:o});return{type:"document",size:e.size,id:e.name,name:e.name,status:"failed",error:o}}finally{p.setIsUploading(!1)}})),onWebsiteUpload:t=>e(void 0,void 0,void 0,(function*(){p.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");p.setIsUploading(!0),p.setIsShowList(!0),p.setWebsiteLink(""),p.setDocuments([{type:"website",id:e,size:0,name:e,status:"uploading"}]);const t=yield f.website({formId:m,responseId:l,website:e}),{success:o,documentId:s}=t;if(!o)throw new Error("Website processing failed, please try again.");p.setDocuments([{type:"website",id:e,size:0,name:e,status:"finished",documentId:s}]);return{type:"website",id:e,name:e,size:0,status:"finished",documentId:s}}catch(t){const o=a(t);if(console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL"))return p.setDocumentError(o),null;p.editDocument({type:"website",id:e,size:0,name:e,status:"failed",error:o});return{type:"website",id:e,size:0,name:e,status:"failed",error:o}}finally{p.setIsUploading(!1)}})),onEditDocumentByDocId:p.editDocumentByDocId})};export{u as useDocument};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as i}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import r from"./Document.js";import l from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:p,isIntroExpand:x})=>{var h,u;const{formId:f,pickaxe:g,styles:v,colors:b,misc:j,responsiveBy:k,isNewChat:w}=o(),N=c(),y=null!==(h=null==g?void 0:g.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===p.role?e("div",Object.assign({className:m("flex flex-col",0===d&&w&&"viewport"===k&&"min-[767px]:max-w-[80%]",0===d&&w&&"container"===k&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:"flex gap-x-3"},{children:[j.isChatImage&&"NONE"!==y&&e(n,{src:y,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:b.text}),s("div",Object.assign({className:"flex flex-col"},{children:[e("div",Object.assign({className:m(N.b2,"chat-message pt-3")},{children:e(a,Object.assign({theme:v.theme,accentColor:b.accent,linkPreviews:!0,actions:!0},{children:e(i,Object.assign({value:p.content},0===d&&w&&p.content.length>470&&3===(null!==(u=null==g?void 0:g.icebreakers)&&void 0!==u?u:[]).length&&!p.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:x?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(l,{color:b.accent,text:p.content})}))]}))]}))})):"user"===p.role?e("div",Object.assign({className:m("flex gap-x-3 justify-self-end pl-9","viewport"===k?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:m(N.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:b.secondary+"80",color:b.secondaryText,borderRadius:v.cornerRadius}},{children:[p.documentIds&&p.documentIds.length>0&&e("div",Object.assign({className:"flex flex-col items-end"},{children:p.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:v.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(r,{documentId:s})},s)))})),e(a,Object.assign({theme:v.theme,accentColor:b.accent},{children:e(i,{value:p.content})}))]}))})):e("div",{})};export{d as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as i}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import r from"./Document.js";import l from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:p,isIntroExpand:x})=>{var h,u;const{formId:f,pickaxe:g,styles:v,colors:b,misc:j,responsiveBy:k,isNewChat:w}=o(),N=c(),y=null!==(h=null==g?void 0:g.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===p.role?e("div",Object.assign({className:m("flex flex-col",0===d&&w&&"viewport"===k&&"min-[767px]:max-w-[80%]",0===d&&w&&"container"===k&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:"flex gap-x-3"},{children:[j.isChatImage&&"NONE"!==y&&e(n,{src:y,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:b.text}),s("div",Object.assign({className:"flex flex-col"},{children:[e("div",Object.assign({className:m(N.b2,"chat-message pt-3")},{children:e(a,Object.assign({theme:v.theme,accentColor:b.accent,actions:!0},{children:e(i,Object.assign({value:p.content},0===d&&w&&p.content.length>470&&3===(null!==(u=null==g?void 0:g.icebreakers)&&void 0!==u?u:[]).length&&!p.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:x?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(l,{color:b.accent,text:p.content})}))]}))]}))})):"user"===p.role?e("div",Object.assign({className:m("flex gap-x-3 justify-self-end pl-9","viewport"===k?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:m(N.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:b.secondary+"80",color:b.secondaryText,borderRadius:v.cornerRadius}},{children:[p.documentIds&&p.documentIds.length>0&&e("div",Object.assign({className:"flex flex-col items-end"},{children:p.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:v.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(r,{documentId:s})},s)))})),e(a,Object.assign({theme:v.theme,accentColor:b.accent},{children:e(i,{value:p.content})}))]}))})):e("div",{})};export{d as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as i}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as l}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as n}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as r}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../common/PickaxeIcon.js";import m from"../../../Core/ErrorAlert.js";import d from"../../../Core/Skeleton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import x from"../../common/PickaxeHead.js";import f from"../../common/PickaxeCompactHead.js";import u from"../../common/PickaxeUpgradeCard.js";import h from"./Message.js";import g from"../../common/PickaxeBranding.js";import j from"../../../../common/cn.js";const w=({hideInfo:w,isInputFocused:v})=>{var N;const b=r(),k=n(),{pickaxe:y,colors:C,misc:O,isNewChat:S,isEmbed:I,setChatId:P}=o(),{scrollContainerRef:L}=l(),{messages:E,status:A,limitData:H,error:$}=t(),{height:z}=i(),D=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!D),[w,b.isSuccess,S,D]),R=a((()=>{var e,s;return!!E.length&&!(null!==(s=null===(e=null==E?void 0:E[E.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[E]);return e("div",Object.assign({ref:L,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${z}px - 74px)`}},{children:s("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(F||!I)&&!O.isWhiteLabel&&e(g,{className:j("absolute top-4 right-4",!F&&!I&&"top-2"),animateHover:!0}),e(x,{className:j("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",F&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>P("")}),I&&!b.isLoading&&e(f,{className:j("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!F&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>P("")}),e("div",Object.assign({className:j("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",I&&!b.isLoading&&!F&&"mt-0")},{children:b.isLoading?s("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[S&&s("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e(d,{className:"w-[72px] h-[72px]"}),e(d,{className:"h-[20px] mt-6 w-full"}),e(d,{className:"h-[20px] mt-2 w-full"}),e(d,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(d,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(d,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(d,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):b.isError?e("div",Object.assign({className:"flex w-full justify-center"},{children:s("p",Object.assign({className:j(k.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):b.data?s("div",Object.assign({className:"flex flex-col w-full"},{children:[s("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[b.data.messages.map(((s,a)=>e(h,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),E.map(((s,a)=>e(h,{index:b.data.messages.length+a,message:s},a))),"fetching"===A||R?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==y?void 0:y.chaticon)&&e(c,{src:null!==(N=null==y?void 0:y.chaticon)&&void 0!==N?N:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e("div",{className:j("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:C.secondaryText}},a)))}))]})):H?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):$?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(m,{error:$})})):null]})),e(p,{className:"w-full"})]})):null}))]}))}))};export{w as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as i}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as l}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as n}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as r}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../common/PickaxeIcon.js";import m from"../../../Core/ErrorAlert.js";import d from"../../../Core/Skeleton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import x from"../../common/PickaxeHead.js";import f from"../../common/PickaxeCompactHead.js";import u from"../../common/PickaxeUpgradeCard.js";import h from"./Message.js";import g from"../../common/PickaxeBranding.js";import j from"../../../../common/cn.js";const w=({hideInfo:w,isInputFocused:v})=>{var N;const b=r(),k=n(),{pickaxe:y,colors:C,misc:O,isNewChat:S,isEmbed:I,setChatId:P}=o(),{scrollContainerRef:L}=l(),{messages:E,status:A,limitData:H,error:$}=t(),{height:z}=i(),D=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!D),[w,b.isSuccess,S,D]),R=a((()=>{var e,s;return!!E.length&&!(null!==(s=null===(e=null==E?void 0:E[E.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[E]);return e("div",Object.assign({ref:L,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${z}px - 74px)`}},{children:s("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(F||!I)&&!O.isWhiteLabel&&e(g,{className:j("absolute top-4 right-4",!F&&!I&&"top-2"),animateHover:!0}),e(x,{className:j("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",F&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>P("")}),I&&!b.isLoading&&e(f,{className:j("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!F&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>P("")}),e("div",Object.assign({className:j("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",I&&!b.isLoading&&!F&&"mt-0")},{children:b.isLoading&&!(null==y?void 0:y.enablechatresponses)?s("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[S&&s("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e(d,{className:"w-[72px] h-[72px]"}),e(d,{className:"h-[20px] mt-6 w-full"}),e(d,{className:"h-[20px] mt-2 w-full"}),e(d,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(d,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(d,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(d,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):b.isError?e("div",Object.assign({className:"flex w-full justify-center"},{children:s("p",Object.assign({className:j(k.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):b.data?s("div",Object.assign({className:"flex flex-col w-full"},{children:[s("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[b.data.messages.map(((s,a)=>e(h,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),E.map(((s,a)=>e(h,{index:b.data.messages.length+a,message:s},a))),"fetching"===A||R?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==y?void 0:y.chaticon)&&e(c,{src:null!==(N=null==y?void 0:y.chaticon)&&void 0!==N?N:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e("div",{className:j("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:C.secondaryText}},a)))}))]})):H?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):$?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(m,{error:$})})):null]})),e(p,{className:"w-full"})]})):null}))]}))}))};export{w as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as s}from"../../../_virtual/_tslib.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as n,useMemo as i,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as d}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as g}from"../../../hooks/pickaxe/useSubmitResult.js";import{allowedFileMimeTypes as h,allowedImageMimeTypes as b}from"../../../common/documents.js";import{streamer as v}from"../../../common/api/streamer.js";import{useDocument as x}from"../Addons/Document/hooks/useDocument.js";import{useScroll as j}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as y}from"../../../hooks/core/useHover.js";import{formatBytes as w}from"../../../common/utils.js";import I from"../../Icons/attach-vertical.svg.js";import k from"../../Icons/spinner-lines.svg.js";import O from"../../Icons/file.svg.js";import N from"../../Icons/x.svg.js";import C from"../../Icons/arrow-right.svg.js";import R from"../Addons/IceBreaker/index.js";import S from"../../Core/Textarea.js";import A from"../../../common/error.js";import D from"../../../common/cn.js";const U=({isFocused:U,onFocus:E,onBlur:T})=>{var B;const{formId:F,chatId:H,userId:z,studioUserId:P,embedUserId:G,deploymentId:L,pickaxe:W,styles:$,colors:K,responsiveBy:X,isNewChat:_,setIsNewChat:M,setIsShowIceBreaker:q,onGenerateComplete:J}=d(),{messages:Q,status:V,limits:Y,isGenerating:Z,setMessages:ee,setStatus:se,setLimitData:te,setError:oe,setIsGenerating:re}=c(),{documents:ne,isUploading:ie,isImageUploadAllowed:le,setDocuments:ae,onFileUpload:de}=x(),{scrollStartSession:ce,scrollEndSession:ue,scrollToBottom:me}=j({auto:!0}),pe=p(),fe=f(),ge=g(),he=m(),be=u(),[ve,xe]=r(""),je=n(null),ye=y(),{isHover:we}=ye,Ie=e(ye,["isHover"]),ke=y(),{isHover:Oe}=ke,Ne=e(ke,["isHover"]),Ce=i((()=>{var e,s,t;return!!_&&(!!W&&(!pe.isLoading&&(!((null!==(s=null===(e=pe.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=W.icebreakers)||void 0===t?void 0:t.length))))}),[W,_,pe.data,pe.isLoading]),Re=e=>s(void 0,void 0,void 0,(function*(){try{if(ie||"idle"!==V||Z)return;const s=null!=e?e:ve;if(!s)return;xe(""),oe(""),te(null),re(!0),M(!1);const t=new Date,o="enduserupload"===(null==W?void 0:W.documentuploadtype),r=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),n=r.length?r[r.length-1].documentId:"";se("fetching"),ce(),me();const i=Array.from(Q);let l=[...i,{id:Q.length+1,role:"user",content:s}];ee(l),me();const{success:a,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:m,endUserImageId:p,rawUserInput:f,error:g}=yield fe.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,value:s},o&&n&&{documentId:n}),P&&{studioUserId:P}),G&&{embedUserId:G}),L&&{deploymentId:L}));if(!a)throw new Error(null!=g?g:"An error occurred, please try again.");const h=[];m&&h.push(m),p&&h.push(p),h.length>0&&(l=[...i,Object.assign({id:Q.length+1,role:"user",content:s},h&&{documentIds:h})],ee(l),me()),ae([]),me();const b=(yield v({formId:F,responseId:H,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const x=b.getReader(),j=new TextDecoder,y=l.length;let w="",I=!0,k=!1;for(;I;){const{value:e,done:s}=yield x.read();I=!s;const t=j.decode(e);if(t.startsWith("[PXE-ERROR]"))throw new Error(t.replace("[PXE-ERROR]","").trim());if(w+=t.replace(/\u200B/g,""),w)k||(se("streaming"),k=!0),ee([...l.slice(0,y),{id:Q.length+1,role:"assistant",content:w}]);else if(!I&&!w)throw new Error("Server error")}const O=new Date;w&&(me(),yield ge.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,documentIds:u},z&&{userId:z}),P&&{studioUserId:P}),P&&(null==W?void 0:W.studioid)&&{studioId:W.studioid}),G&&{embedUserId:G}),L&&{deploymentId:L}),{messages:[Object.assign(Object.assign({role:"user",message:f},h&&{documentIds:h}),{sentAt:t}),{role:"assistant",message:w,sentAt:O}]})),se("idle"),null==J||J(H))}catch(e){let s=A(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(Y).find((([e])=>s.includes(e)));t?te(t[1]):oe(s),me()}finally{se("idle"),re(!1),ue()}}));return l((()=>{q(Ce)}),[Ce]),t("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[t("div",Object.assign({className:"absolute right-0 bottom-full"},{children:t("div",Object.assign({className:D("flex justify-end flex-col gap-2 pb-4 px-2","viewport"===X?"min-[767px]:items-end":"@[767px]/pickaxe-root:items-end")},{children:Ce&&!U&&t(R,{data:(null==W?void 0:W.icebreakers)||[],onSend:Re})}))})),o("div",Object.assign({className:D("flex flex-col gap-y-2 px-4 py-3","block"===$.formFieldStyle&&"shadow"),style:be},{children:["idle"===V&&ne.length>0&&t("div",Object.assign({className:D("grid grid-cols-1","viewport"===X?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ne.map((e=>{var s,r,n;return t(a,{children:"document"===e.type?o("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:be.borderRadius,borderColor:K.secondaryText+"50"}},{children:[t("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:K.accent,borderRadius:be.borderRadius}},{children:ie?t(k,{className:"w-5 h-5 animate-spin",style:{color:K.accentText}}):t(O,{className:"w-5 h-5",style:{color:K.accentText}})})),o("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[t("p",Object.assign({className:(D(he.b3),"font-medium truncate")},{children:e.name})),t("p",Object.assign({className:D(he.b4,"opacity-80 truncate")},{children:w(e.size)}))]})),t("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:K.accent,borderColor:be.backgroundColor},disabled:ie||"idle"!==V,onClick:()=>ae([])},{children:t(N,{className:"w-4 h-4",style:{color:K.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:be.borderRadius}},{children:["finished"===e.status?t("img",{style:{borderRadius:be.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(n=e.documentId)||void 0===n?void 0:n.split("-")[2]}`,alt:""}):t("div",{className:"h-full w-full animate-pulse",style:{borderRadius:be.borderRadius,backgroundColor:K.secondary}}),t("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:K.accent,borderColor:be.backgroundColor},disabled:ie||"idle"!==V,onClick:()=>ae([])},{children:t(N,{className:"w-4 h-4",style:{color:K.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:"flex items-end gap-x-2"},{children:[t(S,{className:D(he.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!ve.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:ve,placeholder:null!==(B=null==W?void 0:W.placeholdertext)&&void 0!==B?B:"What do you want to talk about?",onChange:e=>xe(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ie||"idle"!==V||Re()))},onFocus:E,onBlur:T}),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==W?void 0:W.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:Oe?K.accent+"10":void 0},disabled:ie||"idle"!==V,onClick:()=>{var e;return null===(e=je.current)||void 0===e?void 0:e.click()}},Ne,{children:[t("input",{id:"file-upload",ref:je,type:"file",accept:[...h,...le?b:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield de(Array.from(e.target.files||[])),e.target.value=""}))}),t(I,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Oe?K.accent:K.accent+"80"}})]})),t("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(we||ve.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!Z?K.accent:K.accent+"10"},disabled:ie||"idle"!==V,onClick:()=>Re()},Ie,{children:t(C,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(we||ve.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!Z?K.accentText:K.accent+"80"}})}))]}))]}))]}))]}))}))};export{U as default};
1
+ import{__rest as e,__awaiter as s}from"../../../_virtual/_tslib.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as d}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{allowedFileMimeTypes as h,allowedImageMimeTypes as g}from"../../../common/documents.js";import{useDocument as b}from"../Addons/Document/hooks/useDocument.js";import{useScroll as v}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as x}from"../../../hooks/core/useHover.js";import{formatBytes as y}from"../../../common/utils.js";import j from"../../Icons/attach-vertical.svg.js";import k from"../../Icons/spinner-lines.svg.js";import w from"../../Icons/file.svg.js";import I from"../../Icons/x.svg.js";import N from"../../Icons/arrow-right.svg.js";import O from"../Addons/IceBreaker/index.js";import C from"../../Core/Textarea.js";import S from"../../../common/error.js";import R from"../../../common/cn.js";const A=({isFocused:A,onFocus:T,onBlur:D})=>{var U;const{formId:B,chatId:F,userId:E,studioUserId:H,embedUserId:z,deploymentId:G,pickaxe:L,styles:$,colors:K,responsiveBy:P,isNewChat:W,setIsNewChat:_,setIsShowIceBreaker:M,onGenerateComplete:q}=c(),{messages:J,status:Q,limits:V,isGenerating:X,setMessages:Y,setStatus:Z,setLimitData:ee,setError:se,setIsGenerating:te}=d(),{documents:oe,isUploading:re,isImageUploadAllowed:ie,setDocuments:ne,onFileUpload:le}=b(),{scrollStartSession:ae,scrollEndSession:ce,scrollToBottom:de}=v({auto:!0}),ue=p(),me=f(),pe=m(),fe=u(),[he,ge]=r(""),be=i(null),ve=x(),{isHover:xe}=ve,ye=e(ve,["isHover"]),je=x(),{isHover:ke}=je,we=e(je,["isHover"]),Ie=n((()=>{var e,s,t;return!!W&&(!!L&&(!ue.isLoading&&(!((null!==(s=null===(e=ue.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=L.icebreakers)||void 0===t?void 0:t.length))))}),[L,W,ue.data,ue.isLoading]),Ne=e=>s(void 0,void 0,void 0,(function*(){try{if("idle"!==Q||X||re)return;const s=null!=e?e:he;if(!s)return;se(""),ee(null),ge(""),te(!0),_(!1),Z("fetching"),ae(),de();const t=oe.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=t.length?t[t.length-1].documentId:"",r="enduserupload"===(null==L?void 0:L.documentuploadtype)&&o,i=[...Array.from(J),Object.assign({id:J.length+1,role:"user",content:s},r&&{documentIds:[o]})];Y(i),de(),r&&ne([]);const n=(yield me.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:B,responseId:F,value:s},r&&{documentId:o}),E&&{userId:E}),H&&{studioUserId:H}),z&&{embedUserId:z}),G&&{deploymentId:G}))).body;if(!n)throw new Error("Streaming error");const l=i.length,a=new TextDecoder,c=n.getReader();let d="",u=!0,m=!1;for(;u;){const{value:e,done:s}=yield c.read();if(s){u=!1;break}const t=a.decode(e,{stream:!0}).replace(/\u200B/g,"");if("[DONE]"===t){u=!1;break}d+=t,d&&(m||(Z("streaming"),m=!0),Y([...i.slice(0,l),{id:J.length+1,role:"assistant",content:d}]))}null==q||q(F)}catch(e){let s=S(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(V).find((([e])=>s.includes(e)));t?ee(t[1]):se(s)}finally{de(),Z("idle"),te(!1),ce()}}));return l((()=>{M(Ie)}),[Ie]),t("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[t("div",Object.assign({className:"absolute right-0 bottom-full"},{children:t("div",Object.assign({className:R("flex justify-end flex-col gap-2 pb-4 px-2","viewport"===P?"min-[767px]:items-end":"@[767px]/pickaxe-root:items-end")},{children:Ie&&!A&&t(O,{data:(null==L?void 0:L.icebreakers)||[],onSend:Ne})}))})),o("div",Object.assign({className:R("flex flex-col gap-y-2 px-4 py-3","block"===$.formFieldStyle&&"shadow"),style:fe},{children:["idle"===Q&&oe.length>0&&t("div",Object.assign({className:R("grid grid-cols-1","viewport"===P?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:oe.map((e=>{var s,r,i;return t(a,{children:"document"===e.type?o("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:fe.borderRadius,borderColor:K.secondaryText+"50"}},{children:[t("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:K.accent,borderRadius:fe.borderRadius}},{children:re?t(k,{className:"w-5 h-5 animate-spin",style:{color:K.accentText}}):t(w,{className:"w-5 h-5",style:{color:K.accentText}})})),o("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[t("p",Object.assign({className:(R(pe.b3),"font-medium truncate")},{children:e.name})),t("p",Object.assign({className:R(pe.b4,"opacity-80 truncate")},{children:y(e.size)}))]})),t("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:K.accent,borderColor:fe.backgroundColor},disabled:re||"idle"!==Q,onClick:()=>ne([])},{children:t(I,{className:"w-4 h-4",style:{color:K.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:fe.borderRadius}},{children:["finished"===e.status?t("img",{style:{borderRadius:fe.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):t("div",{className:"h-full w-full animate-pulse",style:{borderRadius:fe.borderRadius,backgroundColor:K.secondary}}),t("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:K.accent,borderColor:fe.backgroundColor},disabled:re||"idle"!==Q,onClick:()=>ne([])},{children:t(I,{className:"w-4 h-4",style:{color:K.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:"flex items-end gap-x-2"},{children:[t(C,{className:R(pe.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!he.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:he,placeholder:null!==(U=null==L?void 0:L.placeholdertext)&&void 0!==U?U:"What do you want to talk about?",onChange:e=>ge(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),re||"idle"!==Q||Ne()))},onFocus:T,onBlur:D}),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==L?void 0:L.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:ke?K.accent+"10":void 0},disabled:re||"idle"!==Q,onClick:()=>{var e;return null===(e=be.current)||void 0===e?void 0:e.click()}},we,{children:[t("input",{id:"file-upload",ref:be,type:"file",accept:[...h,...ie?g:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield le(Array.from(e.target.files||[])),e.target.value=""}))}),t(j,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:ke?K.accent:K.accent+"80"}})]})),t("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(xe||he.length||oe.length&&oe.every((e=>"finished"===e.status)))&&!X?K.accent:K.accent+"10"},disabled:re||"idle"!==Q,onClick:()=>Ne()},ye,{children:t(N,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(xe||he.length||oe.length&&oe.every((e=>"finished"===e.status)))&&!X?K.accentText:K.accent+"80"}})}))]}))]}))]}))]}))}))};export{A as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as r}from"../../Addons/Document/hooks/useDocument.js";import{format as a}from"date-fns";import{PickaxeMarkdown as l}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import m from"../../../Icons/message-square-notes.svg.js";import d from"../../../Icons/visitor.svg.js";import p from"../../common/PickaxeIcon.js";import h from"../../common/PickaxeSimpleButton.js";import u from"../../common/PickaxeCopyButton.js";import f from"../../../../common/cn.js";const g=({item:g})=>{const{pickaxe:x,styles:v,colors:b,misc:j,translations:k,setChatId:y,setIsNewChat:w}=t(),{setMessages:N}=n(),{setDocuments:O}=r(),C=i(),I=o((()=>a(g.createdAt,"hh:mm a MMM dd, yy")),[g]),M=o((()=>g&&g.messages?g.messages.length:0),[g]),P=o((()=>{var e,s,o,t;if("form"===g.type){return(null!==(e=g.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}return null!==(t=null===(o=null===(s=g.messages)||void 0===s?void 0:s[0])||void 0===o?void 0:o.message)&&void 0!==t?t:""}),[g]),$=o((()=>{var e,s,o,t;return"form"===g.type?null!==(e=g.questionResponse)&&void 0!==e?e:"":null!==(t=null===(o=null===(s=g.messages)||void 0===s?void 0:s[1])||void 0===o?void 0:o.message)&&void 0!==t?t:""}),[g]);return e("div",Object.assign({className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:b.primary,color:b.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(d,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-1.5 scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${g.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:P.length<280}),s("div",{className:"danger-html hidden flex-col peer-checked:flex",dangerouslySetInnerHTML:{__html:P}}),s("label",Object.assign({htmlFor:`${g.responseId}-input`,className:f(C.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold peer-checked:hidden hover:cursor-pointer"),style:{color:b.accent}},{children:(null==k?void 0:k["see-input"])||"See input"})),s("label",Object.assign({htmlFor:`${g.responseId}-input`,className:f(C.b3,"hidden shrink-0 whitespace-nowrap font-semibold peer-checked:flex hover:cursor-pointer"),style:{color:b.accent}},{children:(null==k?void 0:k["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:b.secondary,color:b.secondaryText}},{children:[j.isChatImage&&s(p,{src:null==x?void 0:x.chaticon,alt:`${null==x?void 0:x.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:b.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(l,Object.assign({theme:v.theme,accentColor:b.accent,linkPreviews:!0,actions:!0},{children:s(c,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:$})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==x?void 0:x.enablechatresponses)&&e(h,Object.assign({color:b.accent,onClick:()=>{return e=g.responseId,O([]),N([]),w(!1),void y(e);var e}},{children:[s(m,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:f(C.b3,"font-semibold")},{children:M+1}))]})),s(u,{color:b.accent,text:$})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:f(C.b3,"font-semibold uppercase opacity-30")},{children:I}))}))]}))]}))]}))]}))};export{g as default};
1
+ import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as a}from"../../Addons/Document/hooks/useDocument.js";import{format as r}from"date-fns";import{PickaxeMarkdown as l}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import m from"../../../Icons/message-square-notes.svg.js";import d from"../../../Icons/visitor.svg.js";import p from"../../common/PickaxeIcon.js";import h from"../../common/PickaxeSimpleButton.js";import u from"../../common/PickaxeCopyButton.js";import f from"../../../../common/cn.js";const g=({item:g})=>{const{pickaxe:x,styles:v,colors:b,misc:j,translations:k,setChatId:y,setIsNewChat:w}=t(),{setMessages:N}=n(),{setDocuments:O}=a(),C=i(),I=o((()=>r(g.createdAt,"hh:mm a MMM dd, yy")),[g]),M=o((()=>g&&g.messages?g.messages.length:0),[g]),P=o((()=>{var e,s,o,t;if("form"===g.type){return(null!==(e=g.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}return null!==(t=null===(o=null===(s=g.messages)||void 0===s?void 0:s[0])||void 0===o?void 0:o.message)&&void 0!==t?t:""}),[g]),$=o((()=>{var e,s,o,t;return"form"===g.type?null!==(e=g.questionResponse)&&void 0!==e?e:"":null!==(t=null===(o=null===(s=g.messages)||void 0===s?void 0:s[1])||void 0===o?void 0:o.message)&&void 0!==t?t:""}),[g]);return e("div",Object.assign({className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:b.primary,color:b.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(d,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-1.5 scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${g.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:P.length<280}),s("div",{className:"danger-html hidden flex-col peer-checked:flex",dangerouslySetInnerHTML:{__html:P}}),s("label",Object.assign({htmlFor:`${g.responseId}-input`,className:f(C.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold peer-checked:hidden hover:cursor-pointer"),style:{color:b.accent}},{children:(null==k?void 0:k["see-input"])||"See input"})),s("label",Object.assign({htmlFor:`${g.responseId}-input`,className:f(C.b3,"hidden shrink-0 whitespace-nowrap font-semibold peer-checked:flex hover:cursor-pointer"),style:{color:b.accent}},{children:(null==k?void 0:k["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:b.secondary,color:b.secondaryText}},{children:[j.isChatImage&&s(p,{src:null==x?void 0:x.chaticon,alt:`${null==x?void 0:x.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:b.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(l,Object.assign({theme:v.theme,accentColor:b.accent,actions:!0},{children:s(c,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:$})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==x?void 0:x.enablechatresponses)&&e(h,Object.assign({color:b.accent,onClick:()=>{return e=g.responseId,O([]),N([]),w(!1),void y(e);var e}},{children:[s(m,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:f(C.b3,"font-semibold")},{children:M+1}))]})),s(u,{color:b.accent,text:$})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:f(C.b3,"font-semibold uppercase opacity-30")},{children:I}))}))]}))]}))]}))]}))};export{g as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useScrollContext as r}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{format as c}from"date-fns";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as m}from"../../common/PickaxeMarkdown/Renderer.js";import d from"../../../Icons/message-square-notes.svg.js";import p from"../../../Icons/visitor.svg.js";import h from"../../common/PickaxeIcon.js";import f from"../../common/PickaxeSimpleButton.js";import u from"../../common/PickaxeCopyButton.js";import x from"../../Addons/Scroll/ScrollLockView.js";import g from"../../../../common/cn.js";const b=()=>{var b;const{pickaxe:v,styles:j,colors:k,misc:y,translations:w,setChatId:N,setIsNewChat:O}=t(),{response:C,setMessages:I}=n(),{scrollTargetRef:S}=r(),{setDocuments:D}=l(),M=i(),P=o((()=>c(C?C.createdAt:new Date,"hh:mm a MMM dd, yy")),[C]),$=o((()=>{var e;if(!C)return"";return(null!==(e=C.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[C]);return C?e("div",Object.assign({ref:S,className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:k.primary,color:k.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(p,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[s("input",{id:`${C.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:$.length<280}),s("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:$}}),s("label",Object.assign({htmlFor:`${C.responseId}-input`,className:g(M.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["see-input"])||"See input"})),s("label",Object.assign({htmlFor:`${C.responseId}-input`,className:g(M.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[y.isChatImage&&s(h,{src:null==v?void 0:v.chaticon,alt:`${null==v?void 0:v.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(a,Object.assign({theme:j.theme,accentColor:k.accent,linkPreviews:!0,actions:!0},{children:s(m,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:C.questionResponse})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==v?void 0:v.enablechatresponses)&&e(f,Object.assign({color:k.accent,onClick:()=>{return e=C.responseId,D([]),I([]),O(!1),void N(e);var e}},{children:[s(d,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:g(M.b3,"font-semibold")},{children:C.messages.length+1}))]})),s(u,{color:k.accent,text:null!==(b=C.questionResponse)&&void 0!==b?b:""})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:g(M.b3,"font-semibold uppercase opacity-30")},{children:P}))}))]}))]}))]})),s(x,{className:"w-full"})]})):null};export{b as default};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useMemo as s}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useScrollContext as i}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as r}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as l}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import{format as a}from"date-fns";import d from"../../../Icons/visitor.svg.js";import m from"../../common/PickaxeIcon.js";import p from"../../common/PickaxeCopyButton.js";import h from"../../Addons/Scroll/ScrollLockView.js";import f from"../../../../common/cn.js";const x=()=>{var x;const{pickaxe:u,styles:b,colors:g,misc:v,translations:j}=t(),{response:y}=n(),{scrollTargetRef:k}=i(),w=r(),N=s((()=>a(y?y.sentAt:new Date,"hh:mm a MMM dd, yy")),[y]),O=s((()=>{var e;if(!y)return"";return(null!==(e=y.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[y]);return y?e("div",Object.assign({ref:k,className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:g.primary,color:g.text}},{children:[o("div",Object.assign({className:"shrink-0 pt-1"},{children:o(d,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[o("input",{id:`${y.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:O.length<280}),o("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:O}}),o("label",Object.assign({htmlFor:`${y.responseId}-input`,className:f(w.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:g.accent}},{children:(null==j?void 0:j["see-input"])||"See input"})),o("label",Object.assign({htmlFor:`${y.responseId}-input`,className:f(w.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:g.accent}},{children:(null==j?void 0:j["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:g.secondary,color:g.secondaryText}},{children:[v.isChatImage&&o(m,{src:null==u?void 0:u.chaticon,alt:`${null==u?void 0:u.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:g.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[o(l,Object.assign({theme:b.theme,accentColor:g.accent,actions:!0},{children:o(c,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:y.questionResponse})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[o("div",Object.assign({className:"flex items-center gap-3"},{children:o(p,{color:g.accent,text:null!==(x=y.questionResponse)&&void 0!==x?x:""})})),o("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:o("p",Object.assign({className:f(w.b3,"font-semibold uppercase opacity-30")},{children:N}))}))]}))]}))]})),o(h,{className:"w-full"})]})):null};export{x as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as l}from"../../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as a}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as d}from"../../Addons/Scroll/hooks/useScroll.js";import{streamer as c}from"../../../../common/api/streamer.js";import{extractUrlsFromText as u}from"../../../../common/utils.js";import{encode as m}from"@nem035/gpt-3-encoder";import p from"../../common/PickaxeBranding.js";import f from"../../common/PickaxeButton.js";import g from"../../../../common/error.js";import h from"../../../../common/cn.js";const b=({questions:b})=>{var j;const{formId:x,userId:v,studioUserId:w,embedUserId:I,deploymentId:y,pickaxe:O,misc:k,translations:E,responsiveBy:R,isShowHistory:S,setChatId:U,setIsShowHistory:q,setIsNewChat:P,onGenerateComplete:D}=i(),{status:C,limits:A,isGenerating:N,setResponse:L,setMessages:B,setStatus:T,setLimitData:W,setError:G,setIsGenerating:H}=n(),{documents:M,websiteLink:X,isUploading:_,onWebsiteUpload:K,setDocumentError:Y}=a(),{scrollStartSession:z,scrollEndSession:F,scrollToTarget:J}=d({auto:!(null==O?void 0:O.enablechatresponses)}),Q=r(),V=l(),[Z,$]=t(!1);return s("div",Object.assign({className:h("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===R?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[s("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[o(f,Object.assign({className:"px-5 min-h-[42px]",isDisabled:_||"idle"!==C||N||Z,onClick:()=>e(void 0,void 0,void 0,(function*(){var e;try{if(_||"idle"!==C||N||Z)return;L(null),W(null),Y(""),H(!0);const s="enduserupload"===(null==O?void 0:O.documentuploadtype),o=b.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),t=M.filter((e=>"finished"===e.status)),i=u(X),n=M.map((e=>e.name)),r=i.filter((e=>!n.includes(e)));if(r.length){const e=r[r.length-1];$(!0);const s=yield K(e);s&&(t.push(s),yield new Promise((e=>setTimeout(e,5e3)))),$(!1)}else if(o&&s&&!t.length)return void Y("Please paste a valid website/video link or drag a file to add to the knowledge base.");G("");const l=["Multiple Choice","Checkbox"];for(const e of b){if(m(e.input).length>e.maxLength&&!l.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const a=t.length?t[t.length-1]:null;let d={};b.forEach((e=>d=Object.assign(Object.assign({},d),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==a?void 0:a.name)||"":e.input}))),T("fetching"),z(),J();const{success:p,responseId:f,data:g,actionData:h,usedDocumentIds:j,rawUserInput:k,error:E}=yield Q.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign({formId:x,valueObj:d},s&&a&&{documentId:null!==(e=a.documentId)&&void 0!==e?e:""}),w&&{studioUserId:w}),I&&{embedUserId:I}),y&&{deploymentId:y}));if(!p)throw new Error(null!=E?E:"An error occurred, please try again.");J();const R=(yield c({formId:x,responseId:f,data:g,actionData:h})).body;if(!R)throw new Error("Streaming error");const S=R.getReader(),q=new TextDecoder;let A="",F=!0,ee=!1;J();const se=b.map((e=>({id:e.id,question:e.main,answer:e.input})));for(;F;){const{value:e,done:s}=yield S.read();F=!s;const o=q.decode(e);if(o.startsWith("[PXE-ERROR]"))throw new Error(o.replace("[PXE-ERROR]","").trim());if(A+=o.replace(/\u200B/g,""),A)ee||(T("streaming"),ee=!0,(null==O?void 0:O.enablechatresponses)&&(U(f),P(!1))),L({formId:x,responseId:f,documentIds:j,messages:[],questions:se,questionPrompt:k,questionResponse:A,createdAt:new Date}),(null==O?void 0:O.enablechatresponses)&&B([{id:0,role:"assistant",content:A}]);else if(!F&&!A)throw new Error("Server error")}A&&(J(),yield V.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:x,responseId:f,documentIds:j},v&&{userId:v}),w&&{studioUserId:w}),w&&(null==O?void 0:O.studioid)&&{studioId:O.studioid}),I&&{embedUserId:I}),y&&{deploymentId:y}),{questions:se,questionPrompt:k,questionResponse:A})),T("idle"),null==D||D(f))}catch(e){let s=g(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const o=Object.entries(A).find((([e])=>s.includes(e)));o?W(o[1]):G(s),J()}finally{T("idle"),H(!1),$(!1),F()}}))},{children:Z?(null==E?void 0:E.processing)||"Processing...":_?(null==E?void 0:E.uploading)||"Uploading...":"fetching"===C||"streaming"===C?(null==E?void 0:E.loading)||"Loading...":null!==(j=null==O?void 0:O.submittext)&&void 0!==j?j:"Submit"})),k.isHistory&&!S&&o(f,Object.assign({variant:"transparent-text",className:"px-4",onClick:()=>q(!0)},{children:(null==E?void 0:E["see-history"])||"See history"}))]})),!k.isWhiteLabel&&o("div",Object.assign({className:"flex justify-end pr-3"},{children:o(p,{})}))]}))};export{b as default};
1
+ import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as a}from"../../Addons/Scroll/hooks/useScroll.js";import{extractUrlsFromText as d}from"../../../../common/utils.js";import{encode as c}from"@nem035/gpt-3-encoder";import m from"../../common/PickaxeBranding.js";import u from"../../common/PickaxeButton.js";import p from"../../../../common/error.js";import f from"../../../../common/cn.js";const g=({questions:g})=>{var h;const{formId:b,userId:x,studioUserId:j,embedUserId:v,deploymentId:w,pickaxe:k,misc:y,translations:I,responsiveBy:O,isShowHistory:S,setChatId:C,setIsShowHistory:D,setIsNewChat:E,onGenerateComplete:U}=i(),{status:P,limits:R,isGenerating:q,setResponse:N,setMessages:A,setStatus:L,setLimitData:B,setError:T,setIsGenerating:G}=n(),{documents:H,websiteLink:W,isUploading:M,onWebsiteUpload:_,setDocumentError:K}=l(),{scrollStartSession:X,scrollEndSession:Y,scrollToTarget:z}=a({auto:!(null==k?void 0:k.enablechatresponses)}),F=r(),[J,Q]=t(!1);return s("div",Object.assign({className:f("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===O?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[s("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[o(u,Object.assign({className:"px-5 min-h-[42px]",isDisabled:M||"idle"!==P||q||J,onClick:()=>e(void 0,void 0,void 0,(function*(){try{if("idle"!==P||q||M||J)return;T(""),B(null),K(""),N(null),G(!0);const e=["Multiple Choice","Checkbox"];for(const s of g){if(c(s.input).length>s.maxLength&&!e.includes(s.type))throw new Error("One or more of your responses is too long!");if(s.isRequired&&!s.input.trim()&&"userinput:documentupload"!==s.id)throw new Error("You must fill out all required fields.")}const s=H.filter((e=>"finished"===e.status)),o=H.map((e=>e.name)),t="enduserupload"===(null==k?void 0:k.documentuploadtype),i=g.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),n=d(W).filter((e=>!o.includes(e)));if(n.length){const e=n[n.length-1];Q(!0);const o=yield _(e);o&&(s.push(o),yield new Promise((e=>setTimeout(e,5e3)))),Q(!1)}else if(i&&t&&!s.length)return void K("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=s.length?s[s.length-1]:null,l=t&&r&&"finished"===r.status;let a={};g.forEach((e=>a=Object.assign(Object.assign({},a),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==r?void 0:r.name)||"":e.input}))),L("fetching"),X(),z();const m=yield F.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:b,valueObj:a},l&&{documentId:r.documentId}),x&&{userId:x}),j&&{studioUserId:j}),v&&{embedUserId:v}),w&&{deploymentId:w})),u=m.body;if(!u)throw new Error("Streaming error");const p=m.headers.get("X-Pickaxe-Response-Id");if(!p)throw new Error("Response ID not found");const f=new TextDecoder,h=u.getReader();let y="",I=!0,O=!1;for(;I;){const{value:e,done:s}=yield h.read();if(s){I=!1;break}const o=f.decode(e,{stream:!0}).replace(/\u200B/g,"");if("[DONE]"===o){I=!1;break}y+=o,y&&(O||(L("streaming"),O=!0,(null==k?void 0:k.enablechatresponses)&&(C(p),E(!1))),N({formId:b,responseId:p,documentIds:r&&r.documentId?[r.documentId]:[],questions:g.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:y,sentAt:new Date}),(null==k?void 0:k.enablechatresponses)&&A([{id:0,role:"assistant",content:y}]))}null==U||U(p)}catch(e){let s=p(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const o=Object.entries(R).find((([e])=>s.includes(e)));o?B(o[1]):T(s),z()}finally{L("idle"),G(!1),Q(!1),Y()}}))},{children:J?(null==I?void 0:I.processing)||"Processing...":M?(null==I?void 0:I.uploading)||"Uploading...":"fetching"===P||"streaming"===P?(null==I?void 0:I.loading)||"Loading...":null!==(h=null==k?void 0:k.submittext)&&void 0!==h?h:"Submit"})),y.isHistory&&!S&&o(u,Object.assign({variant:"transparent-text",className:"px-4",onClick:()=>D(!0)},{children:(null==I?void 0:I["see-history"])||"See history"}))]})),!y.isWhiteLabel&&o("div",Object.assign({className:"flex justify-end pr-3"},{children:o(m,{})}))]}))};export{g as default};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import o from"../../common/Modal/index.js";import r from"../../common/Modal/Body.js";const s=({src:s,isOpen:i,onChangeIsOpen:n})=>e(o,Object.assign({isOpen:i,onChange:n},{children:e(r,Object.assign({style:{width:"90vw",height:"90vh",border:"none"},avoidOverflow:!0},{children:e("iframe",{src:s,title:"Random HTML",className:"scrollbar scrollbar-thin",style:{width:"100%",height:"100%",flex:1,borderRadius:"8px"}})}))}));export{s as default};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";import{Img as o}from"../Img/index.js";import i from"../common/Action.js";import a from"./Audio.js";import s from"./Html/index.js";const n=({href:n="",children:l})=>{const{accentColor:c,actions:m}=r(),p=t((()=>{if(!n)return"";return n.startsWith("http://")?`https://${n.slice(7)}`:n.startsWith("www.")?`https://${n}`:n}),[n]),u=t((()=>{var e;const t=p.match(/(?:https?:\/\/)?(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[p]),d=t((()=>{var e;const t=p.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[p]),f=t((()=>p.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[p]),w=t((()=>p.includes("action_generated_files")&&p.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[p]),h=t((()=>p.includes("action_generated_files")&&p.match(/\.html$/)),[p]),b=t((()=>m&&p.includes("pickaxe")&&(p.includes("/api/fn/result")||p.includes("/api/function_call_results"))),[m,p]);return u?e("div",Object.assign({className:"pxe-markdown-loom"},{children:e("iframe",Object.assign({title:"loom-embed",src:`https://www.loom.com/embed/${u}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):d?e("div",Object.assign({className:"pxe-markdown-youtube"},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${d}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):f?e(o,{src:p,alt:"string"==typeof l?l:"Markdown Image"}):w?e(a,{url:p}):h?e(s,{url:p}):b?e(i,{jobUrl:p}):e("a",Object.assign({href:p,target:"_blank",rel:"noopener noreferrer",style:{color:c}},{children:l}))};export{n as A};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as r,useEffect as t}from"react";import{usePickaxeMarkdownContext as n}from"../../hooks/usePickaxeMarkdownContext.js";import o from"../../../../../../common/cn.js";const s=({node:t,children:s})=>{const{actionState:i}=n(),c=r((()=>{if(!t||!t.properties)return"processing";const e=t.properties.dataIndex;return e?i[e]:"processing"}),[i]);return e("div",Object.assign({className:o("done"!==c&&"error"!==c&&"pxe-blink")},{children:s}))},i=({node:r})=>{const{setActionState:o}=n();return t((()=>{if(!r||!r.properties)return;const e=r.properties.dataIndex;e&&o((r=>Object.assign(Object.assign({},r),{[e]:"done"})))}),[]),e("div",{})},c=({node:r,children:o})=>{const{setActionState:s}=n();return t((()=>{if(!r||!r.properties)return;const e=r.properties.dataIndex;e&&s((r=>Object.assign(Object.assign({},r),{[e]:"error"})))}),[]),e("div",Object.assign({className:"pxe-red pxe-action-error"},{children:o}))};export{s as ActionCaption,c as ActionError,i as ActionFinished};
@@ -0,0 +1 @@
1
+ import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as i,jsxs as r}from"react/jsx-runtime";import{Prism as n}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";import t from"../../../PickaxeCopyButton.js";const s=s=>{var a,l,{children:c,className:d}=s,m=e(s,["children","className"]);const{syntaxTheme:h}=o(),g=/language-(\w+)/.exec(d||"");return g?i("div",Object.assign({className:"pxe-markdown-code"},{children:r("div",{children:[i("div",{children:i(t,{color:"#FFFFFF",text:null!==(a=null==c?void 0:c.toString())&&void 0!==a?a:"",iconClassName:"w-4 h-4 text-white"})}),i("div",{children:i(n,Object.assign({},m,{PreTag:"div",language:null!==(l=null==g?void 0:g[1])&&void 0!==l?l:"js",style:h,showLineNumbers:!0},{children:String(c).replace(/\n$/,"")}))})]})})):i("code",Object.assign({},m,{className:"pxe-markdown-code-inline"},{children:c}))};export{s as Code};
@@ -0,0 +1 @@
1
+ import{jsx as h}from"react/jsx-runtime";const r=({children:r})=>h("h1",{children:r}),e=({children:r})=>h("h2",{children:r}),c=({children:r})=>h("h3",{children:r}),i=({children:r})=>h("h4",{children:r}),n=({children:r})=>h("h5",{children:r});export{r as H1,e as H2,c as H3,i as H4,n as H5};
@@ -0,0 +1 @@
1
+ import{__rest as t}from"../../../../../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";const r=r=>{var{title:i="Random Iframe",children:l,style:s}=r,a=t(r,["title","children","style"]);return e("iframe",Object.assign({title:i,style:Object.assign({borderRadius:"8px",width:"100%"},s),allowFullScreen:!0},a,{children:l}))};export{r as Iframe};
@@ -0,0 +1 @@
1
+ import{__rest as o,__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as r}from"react";import{usePickaxeMarkdownContext as n}from"../../hooks/usePickaxeMarkdownContext.js";import{useHover as s}from"../../../../../../hooks/core/useHover.js";import{motion as a}from"framer-motion";import l from"../../../../../Icons/download.svg.js";import c from"../../../../../Icons/copied-new.svg.js";import p from"../../../../../Icons/copy-new.svg.js";import d from"./ImgModal.js";import m from"copy-to-clipboard";const b=({src:b,alt:h})=>{const{accentColor:g,accentTextColor:x,readOnly:y}=n(),[f,u]=r(!1),[v,w]=r(!1),[j,k]=r(!1),O=s(),{isHover:C}=O,S=o(O,["isHover"]);return i("div",Object.assign({className:"pxe-markdown-image",style:Object.assign({display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px"},!y&&{transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:C?"translateY(-5px)":"translateY(0)"})},!y&&Object.assign({},S),{children:[v&&t(d,{src:b,isOpen:v,onChangeIsOpen:w}),f?t("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):i("div",Object.assign({style:{position:"relative"}},{children:[!y&&i(a.div,Object.assign({initial:"hidden",animate:C||j?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[t(a.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:g,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>{o.stopPropagation(),window.open(b,"_blank")}},{children:t(l,{width:24,height:24,style:{color:x,flexShrink:0}})})),t(a.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:g,opacity:j?1:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>{o.stopPropagation(),e(void 0,void 0,void 0,(function*(){try{k(!0),m(b||""),yield new Promise((o=>setTimeout(o,1500)))}finally{k(!1)}}))}},{children:t(j?c:p,{width:24,height:24,style:{color:x,flexShrink:0}})}))]})),t("img",Object.assign({src:b,alt:h,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:C?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>u(!0)},!y&&{onClick:()=>w(!0)}))]}))]}))};export{b as Img};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";const e=({children:e})=>r("ol",{children:e}),i=({children:e})=>r("ul",{children:e}),l=({children:e})=>r("li",{children:e});export{l as Li,e as Ol,i as Ul};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";const e=({children:e})=>{const{theme:t}=o();return r("blockquote",Object.assign({style:{borderLeft:"dark"===t?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===t?"#8B8B8B":"#656D76"}},{children:e}))},t=()=>{const{theme:e}=o();return r("hr",{style:{border:0,borderTop:"dark"===e?"1px solid #30363D":"1px solid #D0D7DE"}})},s=()=>r("br",{});export{e as Blockquote,s as Br,t as Hr};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import l from"../common/Action.js";const n=({children:n})=>{const{actions:o}=i(),s=r((()=>{var e;if("string"!=typeof n)return null;const t=n.match(/(?:https?:\/\/)?(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[n]),c=r((()=>{var e;if("string"!=typeof n)return null;const t=n.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[n]);if(s)return e("div",Object.assign({className:"pxe-markdown-loom"},{children:e("iframe",Object.assign({title:"loom-embed",src:`https://www.loom.com/embed/${s}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))}));if(c)return e("div",Object.assign({className:"pxe-markdown-youtube"},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${c}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))}));if(o&&"string"==typeof n&&n.includes("pickaxe")&&(n.includes("/api/fn/result")||n.includes("/api/function_call_results"))){const r=n.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=n.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e("p",{children:r}),e(l,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e("p",{children:n})};export{n as P};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";const t=({children:r})=>e("div",Object.assign({className:"pxe-markdown-table"},{children:e("table",{children:r})})),i=({children:r})=>e("th",{children:r}),n=({children:t})=>{const{theme:i}=r();return e("tr",Object.assign({style:{border:"dark"===i?"1px solid #30363D":"1px solid #D0D7DE"}},{children:t}))},d=({children:r})=>e("td",{children:r});export{t as Table,d as Td,i as Th,n as Tr};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as t,useMemo as o,useEffect as s}from"react";import{usePickaxeMarkdownContext as l}from"./hooks/usePickaxeMarkdownContext.js";import d from"react-markdown";import c from"remark-gfm";import a from"remark-math";import h from"rehype-katex";import m from"rehype-raw";import p from"./Custom/A/index.js";import u from"./Custom/P/index.js";import g from"./Custom/Img/index.js";import f from"./Custom/Iframe/index.js";import b from"./Custom/Code/index.js";import x from"./Custom/common/LinkPreview.js";import k from"../../../../common/cn.js";const j=({className:j,style:w,value:D,recursion:v=!1,children:C,maxLines:y,multiLineBreaks:O,onExpandClick:$})=>{const{theme:N,accentColor:S,websiteMetadatas:B}=l(),[L,M]=i({width:0,height:0}),[P,E]=i(null),I=t(null),T=o((()=>{if(!D)return"";let e=D.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),O&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[D,O]);s((()=>{if(!y)return void E(null);if(!I.current||!T||P)return;const e=I.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=y*r;if(!(L.height>n))return;const i=Math.floor(L.width/8),t=Math.floor(i*y);E(T.slice(0,t)+'<span class="pxe-expand-btn">...</span>')}),[T,y,L,P]);const q={h1:({node:e,children:r})=>n("h1",{children:r}),h2:({node:e,children:r})=>n("h2",{children:r}),h3:({node:e,children:r})=>n("h3",{children:r}),h4:({node:e,children:r})=>n("h4",{children:r}),h5:({node:e,children:r})=>n("h5",{children:r}),p:u,a:p,ol:({node:e,children:r})=>n("ol",{children:r}),ul:({node:e,children:r})=>n("ul",{children:r}),li:({node:e,children:r})=>n("li",{children:r}),table:({children:e})=>n("div",Object.assign({className:"pxe-markdown-table"},{children:n("table",{children:e})})),th:({node:e,children:r})=>n("th",{children:r}),tr:({node:e,children:r})=>n("tr",Object.assign({style:{border:"dark"===N?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>n("td",{children:r}),code:b,blockquote:({node:e,children:r})=>n("blockquote",Object.assign({style:{borderLeft:"dark"===N?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===N?"#8B8B8B":"#656D76"}},{children:r})),img:g,iframe:f,hr:()=>n("hr",{style:{border:0,borderTop:"dark"===N?"1px solid #30363D":"1px solid #D0D7DE"}}),span:r=>{var{node:i,children:t}=r,o=e(r,["node","children"]);return"pxe-expand-btn"===o.className?n("span",Object.assign({},o,{style:Object.assign({display:"inline",fontWeight:500,color:S,marginLeft:".25rem",userSelect:"none"},$&&{cursor:"pointer"})},$&&{onClick:$},{children:t})):n("span",Object.assign({},o,{children:t}))},br:()=>n("br",{})};s((()=>{if(!I.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;M({width:e,height:n})}}));return e.observe(I.current),()=>{e.disconnect()}}),[]);const R=P||T,W=!v&&B.length>0?"\n\n---":"";return r("div",Object.assign({className:"pxe-markdown",ref:I,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},w)},{children:[n(d,Object.assign({className:k(!v&&"pxe-prose",j),components:q,remarkPlugins:[c,[a,{singleDollarTextMath:!1}]],rehypePlugins:[h,m]},{children:`${R}${W}`})),!v&&B.length>0&&n("div",Object.assign({className:"pxe-link-previews"},{children:B.map(((e,r)=>n(x,{data:e},r)))})),C]}))};export{j as PickaxeMarkdownRenderer};
1
+ import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as t,useRef as o,useMemo as i,useEffect as s}from"react";import{usePickaxeMarkdownContext as m}from"./hooks/usePickaxeMarkdownContext.js";import{rehypePickaxeAction as a}from"./utils/custom-plugins.js";import p from"react-markdown";import c from"remark-gfm";import l from"remark-math";import d from"rehype-katex";import h from"rehype-raw";import{A as f}from"./Components/A/index.js";import{P as u}from"./Components/P/index.js";import{Img as g}from"./Components/Img/index.js";import{Iframe as x}from"./Components/Iframe/index.js";import{Code as j}from"./Components/Code/index.js";import{H1 as b,H2 as C,H3 as k,H4 as w,H5 as v}from"./Components/Headings/index.js";import{Ol as y,Ul as O,Li as $}from"./Components/List/index.js";import{Table as S,Th as A,Tr as L,Td as M}from"./Components/Table/index.js";import{Hr as N,Br as P,Blockquote as I}from"./Components/Others/index.js";import{ActionCaption as T,ActionFinished as B,ActionError as E}from"./Components/Action/index.js";import H from"../../../../common/cn.js";const R=({className:R,style:W,children:_,value:q,maxLines:z,multiLineBreaks:D,recursion:F=!1,onExpandClick:G})=>{const{accentColor:J}=m(),[K,Q]=t({width:0,height:0}),[U,V]=t(null),X=o(null),Y=i((()=>{if(!q)return"";let e=q.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),D&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[q,D]);s((()=>{if(!z)return void V(null);if(!X.current||!Y||U)return;const e=X.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=z*r;if(!(K.height>n))return;const t=Math.floor(K.width/8),o=Math.floor(t*z);V(Y.slice(0,o)+'<span class="pxe-expand-btn">...</span>')}),[Y,z,K,U]);const Z={h1:b,h2:C,h3:k,h4:w,h5:v,p:u,a:f,img:g,iframe:x,code:j,ol:y,ul:O,li:$,table:S,th:A,tr:L,td:M,hr:N,br:P,blockquote:I,span:r=>{var{children:t}=r,o=e(r,["children"]);return"pxe-expand-btn"===o.className?n("span",Object.assign({},o,{style:Object.assign({display:"inline",fontWeight:500,color:J,marginLeft:".25rem",userSelect:"none"},G&&{cursor:"pointer"})},G&&{onClick:G},{children:t})):n("span",Object.assign({},o,{children:t}))},ActionCaption:T,ActionFinished:B,ActionError:E};s((()=>{if(!X.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;Q({width:e,height:n})}}));return e.observe(X.current),()=>{e.disconnect()}}),[]);const ee=U||Y;return r("div",Object.assign({className:"pxe-markdown",ref:X,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},W)},{children:[n(p,Object.assign({className:H(!F&&"pxe-prose",R),components:Z,remarkPlugins:[c,[l,{singleDollarTextMath:!1}]],rehypePlugins:[d,h,a]},{children:ee})),_]}))};export{R as PickaxeMarkdownRenderer};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{createContext as e,useState as r}from"react";const t=e({}),n=({children:e,theme:n="light",syntaxTheme:a,accentColor:c="#228DD7",accentTextColor:l="#FFFFFF",linkPreviews:i=!1,actions:s=!1,readOnly:d=!1})=>{const[F,p]=r(n),[C,m]=r([]),[g,h]=r(i),[u,b]=r(s);return o(t.Provider,Object.assign({value:{theme:F,syntaxTheme:a||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",width:"max-content"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21",width:"max-content"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:c,accentTextColor:l,websiteMetadatas:C,linkPreviews:g,actions:u,readOnly:d,setTheme:p,setWebsiteMetadatas:m,setLinkPreviews:h,setActions:b}},{children:e}))};export{n as PickaxeMarkdown,t as PickaxeMarkdownContext,n as default};
1
+ import{jsx as o}from"react/jsx-runtime";import{createContext as e,useState as r}from"react";const t=e({}),n=({children:e,theme:n="light",syntaxTheme:c,accentColor:a="#228DD7",accentTextColor:l="#FFFFFF",actions:i=!1,readOnly:s=!1})=>{const[d,F]=r(n),[p,C]=r({}),[m,g]=r(i);return o(t.Provider,Object.assign({value:{theme:d,accentColor:a,accentTextColor:l,actionState:p,actions:m,readOnly:s,setTheme:F,setActionState:C,setActions:g,syntaxTheme:c||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",width:"max-content"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21",width:"max-content"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}}}},{children:e}))};export{n as PickaxeMarkdown,t as PickaxeMarkdownContext,n as default};
@@ -0,0 +1 @@
1
+ import{visit as e,SKIP as t}from"unist-util-visit";const i=["action-caption","action-finished","action-error"],n=["ActionCaption","ActionFinished","ActionError"],o=()=>o=>(e(o,"element",(e=>{const t=e.tagName;if(i.includes(t)){const i=t.split("-");e.tagName=i.map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(""),e.properties=e.properties||{}}})),e(o,"element",((e,i,o)=>{if("p"===e.tagName){const r=e.children.filter((e=>"text"===e.type?""!==e.value.trim():"element"===e.type));if(1===r.length){const e=r[0];if("element"===e.type&&n.includes(e.tagName)&&o&&"children"in o&&o.children&&void 0!==i)return o.children.splice(i,1,e),[t,i]}}})),o);export{o as rehypePickaxeAction};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t,Fragment as s}from"react/jsx-runtime";import{usePickaxe as r}from"../../hooks/pickaxe/usePickaxe.js";import{useState as i,useRef as a,useEffect as l}from"react";import{usePickaxeContext as n}from"../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as m}from"../../hooks/pickaxe/useDimensionContext.js";import{generateId as f}from"../../common/utils.js";import d from"./Addons/Scroll/Provider.js";import p from"./Chat/index.js";import x from"./Form/index.js";import u from"../../common/cn.js";import h from"../Core/Skeleton.js";const w=({formId:w,className:k})=>{const{chatId:j,styles:g,colors:v,loadFont:b,responsiveBy:N,isFontLoaded:y,setFormId:C,setChatId:F,setPickaxe:I,setIsFontLoaded:O}=n(),{setMessages:P,setResponse:R,setError:L,setLimitData:H}=c(),{setWidth:D,setHeight:M,setIsMobile:S}=m(),[_,z]=i(!1),A=r(),B=a(null);return l((()=>{C(w)}),[w]),l((()=>{if(!A.data)return;const e=A.data.chatflag;F(e?f(15):""),e?P([]):R(null),L(""),H(null),I(A.data),z(!0)}),[A.data]),l((()=>{e(void 0,void 0,void 0,(function*(){"undefined"!=typeof window&&(y||b&&"Real Head Pro"!==g.font&&((yield import("webfontloader")).default.load({google:{families:[g.font]}}),O(!0)))}))}),[g.font,b,y]),l((()=>{if(!B.current)return;const e=new ResizeObserver((e=>{for(const o of e){const{width:e,height:t}=o.contentRect;D(e),M(t),S(e<768)}}));return e.observe(B.current),()=>{e.disconnect()}}),[B.current]),A.data?o("div",Object.assign({ref:B,className:u("relative @container/pickaxe-root flex flex-col flex-grow w-full h-full",k,"dark"===g.theme&&"dark"),style:Object.assign({backgroundColor:v.primary,color:v.text},g.font&&"Real Head Pro"!==g.font&&{fontFamily:g.font})},{children:A.isLoading||!_?o("div",Object.assign({className:u("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===N?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[o(h,{className:"w-[72px] h-[72px]"}),o(h,{className:"h-[20px] mt-6 w-full"}),o(h,{className:"h-[20px] mt-2 w-full"}),o(h,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),o("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:o(h,{className:u("w-full min-h-[48px]","viewport"===N?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):o(s,{children:o(d,j?{children:o(p,{})}:{children:o(x,{})})})})):null};export{w as Pickaxe};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t,Fragment as s}from"react/jsx-runtime";import{usePickaxe as r}from"../../hooks/pickaxe/usePickaxe.js";import{useState as i,useRef as a,useEffect as l}from"react";import{usePickaxeContext as n}from"../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as m}from"../../hooks/pickaxe/useDimensionContext.js";import{generateId as f}from"../../common/utils.js";import d from"./Addons/Scroll/Provider.js";import p from"../Core/Skeleton.js";import x from"./Chat/index.js";import u from"./Form/index.js";import h from"../../common/cn.js";const w=({formId:w,className:k})=>{const{chatId:j,styles:g,colors:v,loadFont:b,responsiveBy:N,isFontLoaded:y,setFormId:C,setChatId:F,setPickaxe:I,setIsFontLoaded:O}=n(),{setMessages:P,setResponse:R,setError:L,setLimitData:H}=c(),{setWidth:D,setHeight:M,setIsMobile:S}=m(),[_,z]=i(!1),A=r(),B=a(null);return l((()=>{C(w)}),[w]),l((()=>{if(!A.data)return;const e=A.data.chatflag;F(e?f(15):""),e?P([]):R(null),L(""),H(null),I(A.data),z(!0)}),[A.data]),l((()=>{e(void 0,void 0,void 0,(function*(){"undefined"!=typeof window&&(y||b&&"Real Head Pro"!==g.font&&((yield import("webfontloader")).default.load({google:{families:[g.font]}}),O(!0)))}))}),[g.font,b,y]),l((()=>{if(!B.current)return;const e=new ResizeObserver((e=>{for(const o of e){const{width:e,height:t}=o.contentRect;D(e),M(t),S(e<768)}}));return e.observe(B.current),()=>{e.disconnect()}}),[B.current]),A.data?o("div",Object.assign({ref:B,className:h("relative @container/pickaxe-root flex flex-col flex-grow w-full h-full",k,"dark"===g.theme&&"dark"),style:Object.assign({backgroundColor:v.primary,color:v.text},g.font&&"Real Head Pro"!==g.font&&{fontFamily:g.font})},{children:A.isLoading||!_?o("div",Object.assign({className:h("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===N?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[o(p,{className:"w-[72px] h-[72px]"}),o(p,{className:"h-[20px] mt-6 w-full"}),o(p,{className:"h-[20px] mt-2 w-full"}),o(p,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),o("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:o(p,{className:h("w-full min-h-[48px]","viewport"===N?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):o(s,{children:o(d,j?{children:o(x,{})}:{children:o(u,{})})})})):null};export{w as Pickaxe};
@@ -1 +1 @@
1
- import{__awaiter as t}from"../../_virtual/_tslib.js";import{useQuery as o}from"@tanstack/react-query";import{usePickaxeContext as r}from"./usePickaxeContext.js";import e from"../../common/api/utils.js";const i=()=>{const{formId:i}=r();return o({queryKey:["form",i],queryFn:()=>t(void 0,void 0,void 0,(function*(){return(o=>t(void 0,void 0,void 0,(function*(){if(!o)return null;const t=yield e.get(`/pickaxe?formid=${o}`),r=t.data;if(200!==t.status)throw new Error("[_getPickaxe] Failed to fetch pickaxe "+r);return r.pickaxe})))(i)})),enabled:!!i,staleTime:18e4})};export{i as usePickaxe};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{useQuery as o}from"@tanstack/react-query";import{usePickaxeContext as r}from"./usePickaxeContext.js";const t=()=>{const{formId:t}=r();return o({queryKey:["form",t],queryFn:()=>e(void 0,void 0,void 0,(function*(){return(o=>e(void 0,void 0,void 0,(function*(){if(!o)return null;const e=yield fetch(`${process.env.NEXT_PUBLIC_MODAL_CORE_APP_URL}/pickaxe?formid=${o}`,{method:"GET",headers:{"Content-Type":"application/json"}}),{success:r,data:t,error:i}=yield e.json();if(!r)throw new Error(i||"Failed to fetch pickaxe");return t})))(t)})),enabled:!!t,staleTime:18e4})};export{t as usePickaxe};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{useMutation as t}from"@tanstack/react-query";import s from"../../common/api/index.js";const i=()=>t({mutationFn:t=>(({formId:t,responseId:i,documentId:o,studioUserId:d,deploymentId:r,embedUserId:a,pickaxe:n,value:c,valueObj:m})=>e(void 0,void 0,void 0,(function*(){const e=yield s.post("/pickaxe/submit",Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({origin:"pickaxe",formId:t},i&&{responseId:i}),o&&{documentId:o}),d&&{studioUserId:d}),r&&{deploymentId:r}),a&&{embedUserId:a}),n&&{pickaxe:n}),c&&{value:c}),m&&{valueObj:m})),u=e.data;if(200!==e.status)throw new Error("[_getHistory] Failed to fetch history "+u);return u})))(t)});export{i as useSubmit};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{useMutation as s}from"@tanstack/react-query";const o=()=>s({mutationFn:s=>(({formId:s,responseId:o,documentId:t,studioUserId:n,deploymentId:r,embedUserId:c,pickaxe:i,value:a,valueObj:d})=>e(void 0,void 0,void 0,(function*(){const e=yield fetch(`${process.env.NEXT_PUBLIC_API_URL}/pickaxe/sse`,Object.assign({method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:s},o&&{responseId:o}),t&&{documentId:t}),n&&{studioUserId:n}),r&&{deploymentId:r}),c&&{embedUserId:c}),i&&{pickaxe:i}),a&&{value:a}),d&&{valueObj:d}))},(!process.env.NODE_ENV||"development"===process.env.NODE_ENV)&&process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN&&{headers:{"x-pickaxe-session-token":process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN}}));if(200!==e.status){const s=yield e.json();throw new Error(s.error||"Unknown error, please contact support")}if("application/json"===e.headers.get("content-type")){const{success:s,error:o}=yield e.json();if(!s)throw new Error(o||"Unknown error, please contact support")}return e})))(s)});export{o as useSubmit};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{PickaxeMarkdown,PickaxeMarkdownContext}from"./components/Pickaxe/common/PickaxeMarkdown/index.js";export{PickaxeMarkdownRenderer}from"./components/Pickaxe/common/PickaxeMarkdown/Renderer.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";export{useSubmitResult}from"./hooks/pickaxe/useSubmitResult.js";
1
+ export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{PickaxeMarkdown,PickaxeMarkdownContext}from"./components/Pickaxe/common/PickaxeMarkdown/index.js";export{PickaxeMarkdownRenderer}from"./components/Pickaxe/common/PickaxeMarkdown/Renderer.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";