@kanda-libs/ks-component-ts 0.3.90 → 0.3.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanda-libs/ks-component-ts",
3
- "version": "0.3.90",
3
+ "version": "0.3.91",
4
4
  "description": "Kanda form component library",
5
5
  "main": "dist/index.esm.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,26 @@
1
+ import * as t from "io-ts";
2
+ import { BaseId } from "./BaseId";
3
+ import { KagentMessage } from "./KagentMessage";
4
+ import { KagentVisitorInfo } from "./KagentVisitorInfo";
5
+ import { TradeSummary } from "./TradeSummary";
6
+
7
+ export const KagentChat = t.intersection([
8
+ BaseId,
9
+ t.intersection([
10
+ t.type({
11
+ messages: t.array(KagentMessage),
12
+ finished: t.boolean,
13
+ trade_summaries: t.array(TradeSummary),
14
+ }),
15
+ t.partial({
16
+ visitor_info: KagentVisitorInfo,
17
+ }),
18
+ ]),
19
+ ]);
20
+
21
+ export type KagentChat = BaseId & {
22
+ messages: Array<KagentMessage>;
23
+ finished: boolean;
24
+ trade_summaries: Array<TradeSummary>;
25
+ visitor_info?: KagentVisitorInfo;
26
+ };
@@ -0,0 +1,16 @@
1
+ import * as t from "io-ts";
2
+ import { KagentMessage } from "./KagentMessage";
3
+
4
+ export const KagentChatRequest = t.intersection([
5
+ t.type({
6
+ messages: t.array(KagentMessage),
7
+ }),
8
+ t.partial({
9
+ id: t.string,
10
+ }),
11
+ ]);
12
+
13
+ export interface KagentChatRequest {
14
+ id?: string;
15
+ messages: Array<KagentMessage>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import * as t from "io-ts";
2
+ import { DateFromISOString } from "io-ts-types";
3
+
4
+ export const KagentMessage = t.intersection([
5
+ t.type({
6
+ role: t.string,
7
+ content: t.string,
8
+ }),
9
+ t.partial({
10
+ messaged_at: DateFromISOString,
11
+ }),
12
+ ]);
13
+
14
+ export interface KagentMessage {
15
+ role: string;
16
+ content: string;
17
+ messaged_at?: Date;
18
+ }
@@ -0,0 +1,16 @@
1
+ import * as t from "io-ts";
2
+ import { WorkType } from "./WorkType";
3
+
4
+ export const KagentVisitorInfo = t.type({
5
+ summary: t.string,
6
+ postcode: t.string,
7
+ work_type: WorkType,
8
+ contact_name: t.string,
9
+ });
10
+
11
+ export interface KagentVisitorInfo {
12
+ summary: string;
13
+ postcode: string;
14
+ work_type: WorkType;
15
+ contact_name: string;
16
+ }
@@ -105,6 +105,10 @@ export * from "./JobDetails";
105
105
  export * from "./JobInfo";
106
106
  export * from "./JobItem";
107
107
  export * from "./JobOverride";
108
+ export * from "./KagentChat";
109
+ export * from "./KagentChatRequest";
110
+ export * from "./KagentMessage";
111
+ export * from "./KagentVisitorInfo";
108
112
  export * from "./LatLng";
109
113
  export * from "./Lead";
110
114
  export * from "./LeadApplicant";
@@ -316,6 +316,7 @@ import {
316
316
  InfoIntroductionStatsRequestFunction,
317
317
  } from "./infoIntroductionStats";
318
318
  import { infoIPOperation, InfoIPRequestFunction } from "./infoIP";
319
+ import { infoKagentOperation, InfoKagentRequestFunction } from "./infoKagent";
319
320
  import { infoLeadOperation, InfoLeadRequestFunction } from "./infoLead";
320
321
  import {
321
322
  infoLegacyRedirectOperation,
@@ -699,6 +700,7 @@ export const operations: Operations = {
699
700
  infoHealth: infoHealthOperation,
700
701
  infoGhost: infoGhostOperation,
701
702
  infoQuery: infoQueryOperation,
703
+ infoKagent: infoKagentOperation,
702
704
  infoTradeSummary: infoTradeSummaryOperation,
703
705
  infoCompany: infoCompanyOperation,
704
706
  infoOnboarding: infoOnboardingOperation,
@@ -926,6 +928,7 @@ export interface OperationRequestFunctionMap {
926
928
  infoHealth: InfoHealthRequestFunction;
927
929
  infoGhost: InfoGhostRequestFunction;
928
930
  infoQuery: InfoQueryRequestFunction;
931
+ infoKagent: InfoKagentRequestFunction;
929
932
  infoTradeSummary: InfoTradeSummaryRequestFunction;
930
933
  infoCompany: InfoCompanyRequestFunction;
931
934
  infoOnboarding: InfoOnboardingRequestFunction;
@@ -1166,6 +1169,7 @@ export const requestFunctionsBuilder = (
1166
1169
  infoHealth: requestFunctionBuilder(operations.infoHealth, requestAdapter),
1167
1170
  infoGhost: requestFunctionBuilder(operations.infoGhost, requestAdapter),
1168
1171
  infoQuery: requestFunctionBuilder(operations.infoQuery, requestAdapter),
1172
+ infoKagent: requestFunctionBuilder(operations.infoKagent, requestAdapter),
1169
1173
  infoTradeSummary: requestFunctionBuilder(
1170
1174
  operations.infoTradeSummary,
1171
1175
  requestAdapter
@@ -1744,6 +1748,12 @@ export const infoQueryServiceBuilder = (
1744
1748
  infoQuery: requestFunctions.infoQuery,
1745
1749
  });
1746
1750
 
1751
+ export const infoKagentServiceBuilder = (
1752
+ requestFunctions: OperationRequestFunctionMap
1753
+ ) => ({
1754
+ infoKagent: requestFunctions.infoKagent,
1755
+ });
1756
+
1747
1757
  export const tradeSummaryServiceBuilder = (
1748
1758
  requestFunctions: OperationRequestFunctionMap
1749
1759
  ) => ({
@@ -2207,6 +2217,7 @@ export interface Operations {
2207
2217
  infoHealth: typeof infoHealthOperation;
2208
2218
  infoGhost: typeof infoGhostOperation;
2209
2219
  infoQuery: typeof infoQueryOperation;
2220
+ infoKagent: typeof infoKagentOperation;
2210
2221
  infoTradeSummary: typeof infoTradeSummaryOperation;
2211
2222
  infoCompany: typeof infoCompanyOperation;
2212
2223
  infoOnboarding: typeof infoOnboardingOperation;
@@ -0,0 +1,24 @@
1
+ import type { RequestFunction } from "@kanda-libs/openapi-io-ts-runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export const infoKagentOperation = {
5
+ path: "/api/info/kagent",
6
+ method: "post",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.KagentChat },
9
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
10
+ },
11
+ parameters: [],
12
+ requestDefaultHeaders: {
13
+ "Content-Type": "application/json",
14
+ Accept: "application/json",
15
+ },
16
+ body: {
17
+ _tag: "JsonBody",
18
+ },
19
+ } as const;
20
+
21
+ export type InfoKagentRequestFunction = RequestFunction<
22
+ { body: schemas.KagentChatRequest },
23
+ schemas.KagentChat
24
+ >;