@kanda-libs/ks-component-ts 0.3.89 → 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.89",
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,16 @@
1
+ import * as t from "io-ts";
2
+ import { DateFromISOString } from "io-ts-types";
3
+
4
+ export const DeviceRegistration = t.type({
5
+ id: t.string,
6
+ name: t.string,
7
+ token: t.string,
8
+ registered_at: DateFromISOString,
9
+ });
10
+
11
+ export interface DeviceRegistration {
12
+ id: string;
13
+ name: string;
14
+ token: string;
15
+ registered_at: Date;
16
+ }
@@ -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
+ }
@@ -0,0 +1,11 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const NewDeviceRegistrationRequest = t.type({
4
+ name: t.string,
5
+ token: t.string,
6
+ });
7
+
8
+ export interface NewDeviceRegistrationRequest {
9
+ name: string;
10
+ token: string;
11
+ }
@@ -0,0 +1,13 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const UpdateDeviceRegistrationRequest = t.type({
4
+ id: t.string,
5
+ name: t.string,
6
+ token: t.string,
7
+ });
8
+
9
+ export interface UpdateDeviceRegistrationRequest {
10
+ id: string;
11
+ name: string;
12
+ token: string;
13
+ }
@@ -0,0 +1,14 @@
1
+ import * as t from "io-ts";
2
+ import { BaseId } from "./BaseId";
3
+ import { DeviceRegistration } from "./DeviceRegistration";
4
+
5
+ export const UserProfile = t.intersection([
6
+ BaseId,
7
+ t.type({
8
+ device_registrations: t.array(DeviceRegistration),
9
+ }),
10
+ ]);
11
+
12
+ export type UserProfile = BaseId & {
13
+ device_registrations: Array<DeviceRegistration>;
14
+ };
@@ -38,6 +38,7 @@ export * from "./Credit";
38
38
  export * from "./Customer";
39
39
  export * from "./CustomerDetails";
40
40
  export * from "./CustomerOptions";
41
+ export * from "./DeviceRegistration";
41
42
  export * from "./DirectorInfo";
42
43
  export * from "./DirectorVerification";
43
44
  export * from "./Document";
@@ -104,6 +105,10 @@ export * from "./JobDetails";
104
105
  export * from "./JobInfo";
105
106
  export * from "./JobItem";
106
107
  export * from "./JobOverride";
108
+ export * from "./KagentChat";
109
+ export * from "./KagentChatRequest";
110
+ export * from "./KagentMessage";
111
+ export * from "./KagentVisitorInfo";
107
112
  export * from "./LatLng";
108
113
  export * from "./Lead";
109
114
  export * from "./LeadApplicant";
@@ -120,6 +125,7 @@ export * from "./Metarefs";
120
125
  export * from "./Money";
121
126
  export * from "./MoneyTotal";
122
127
  export * from "./Monitor";
128
+ export * from "./NewDeviceRegistrationRequest";
123
129
  export * from "./NotEmployedDetails";
124
130
  export * from "./Onboarding";
125
131
  export * from "./OnboardingStage";
@@ -165,7 +171,9 @@ export * from "./TradeSummary";
165
171
  export * from "./TradeType";
166
172
  export * from "./Training";
167
173
  export * from "./Transaction";
174
+ export * from "./UpdateDeviceRegistrationRequest";
168
175
  export * from "./UserEvent";
176
+ export * from "./UserProfile";
169
177
  export * from "./UserType";
170
178
  export * from "./UTM";
171
179
  export * from "./VatNumber";
@@ -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 deleteProfileDeviceRegistrationOperation = {
5
+ path: "/api/info/profile-device-registration",
6
+ method: "delete",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.UserProfile },
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 DeleteProfileDeviceRegistrationRequestFunction = RequestFunction<
22
+ { body: string },
23
+ schemas.UserProfile
24
+ >;
@@ -0,0 +1,18 @@
1
+ import type { RequestFunction } from "@kanda-libs/openapi-io-ts-runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export const getUserProfileOperation = {
5
+ path: "/api/info/profile",
6
+ method: "get",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.UserProfile },
9
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
10
+ },
11
+ parameters: [],
12
+ requestDefaultHeaders: { Accept: "application/json" },
13
+ } as const;
14
+
15
+ export type GetUserProfileRequestFunction = RequestFunction<
16
+ undefined,
17
+ schemas.UserProfile
18
+ >;
@@ -100,6 +100,10 @@ import {
100
100
  deletePaymentOperation,
101
101
  DeletePaymentRequestFunction,
102
102
  } from "./deletePayment";
103
+ import {
104
+ deleteProfileDeviceRegistrationOperation,
105
+ DeleteProfileDeviceRegistrationRequestFunction,
106
+ } from "./deleteProfileDeviceRegistration";
103
107
  import { deleteRateOperation, DeleteRateRequestFunction } from "./deleteRate";
104
108
  import {
105
109
  deleteSubscriptionOperation,
@@ -251,6 +255,10 @@ import {
251
255
  getTransactionsOperation,
252
256
  GetTransactionsRequestFunction,
253
257
  } from "./getTransactions";
258
+ import {
259
+ getUserProfileOperation,
260
+ GetUserProfileRequestFunction,
261
+ } from "./getUserProfile";
254
262
  import {
255
263
  importFcaApprovedOperation,
256
264
  ImportFcaApprovedRequestFunction,
@@ -308,6 +316,7 @@ import {
308
316
  InfoIntroductionStatsRequestFunction,
309
317
  } from "./infoIntroductionStats";
310
318
  import { infoIPOperation, InfoIPRequestFunction } from "./infoIP";
319
+ import { infoKagentOperation, InfoKagentRequestFunction } from "./infoKagent";
311
320
  import { infoLeadOperation, InfoLeadRequestFunction } from "./infoLead";
312
321
  import {
313
322
  infoLegacyRedirectOperation,
@@ -564,6 +573,10 @@ import {
564
573
  postPaymentOperation,
565
574
  PostPaymentRequestFunction,
566
575
  } from "./postPayment";
576
+ import {
577
+ postProfileDeviceRegistrationOperation,
578
+ PostProfileDeviceRegistrationRequestFunction,
579
+ } from "./postProfileDeviceRegistration";
567
580
  import { postRateOperation, PostRateRequestFunction } from "./postRate";
568
581
  import {
569
582
  postSubscriptionOperation,
@@ -620,6 +633,10 @@ import {
620
633
  } from "./putOnboarding";
621
634
  import { putPartnerOperation, PutPartnerRequestFunction } from "./putPartner";
622
635
  import { putPaymentOperation, PutPaymentRequestFunction } from "./putPayment";
636
+ import {
637
+ putProfileDeviceRegistrationOperation,
638
+ PutProfileDeviceRegistrationRequestFunction,
639
+ } from "./putProfileDeviceRegistration";
623
640
  import { putRateOperation, PutRateRequestFunction } from "./putRate";
624
641
  import {
625
642
  putSubscriptionOperation,
@@ -676,9 +693,14 @@ export const operations: Operations = {
676
693
  me: meOperation,
677
694
  postMe: postMeOperation,
678
695
  putMe: putMeOperation,
696
+ getUserProfile: getUserProfileOperation,
697
+ postProfileDeviceRegistration: postProfileDeviceRegistrationOperation,
698
+ putProfileDeviceRegistration: putProfileDeviceRegistrationOperation,
699
+ deleteProfileDeviceRegistration: deleteProfileDeviceRegistrationOperation,
679
700
  infoHealth: infoHealthOperation,
680
701
  infoGhost: infoGhostOperation,
681
702
  infoQuery: infoQueryOperation,
703
+ infoKagent: infoKagentOperation,
682
704
  infoTradeSummary: infoTradeSummaryOperation,
683
705
  infoCompany: infoCompanyOperation,
684
706
  infoOnboarding: infoOnboardingOperation,
@@ -899,9 +921,14 @@ export interface OperationRequestFunctionMap {
899
921
  me: MeRequestFunction;
900
922
  postMe: PostMeRequestFunction;
901
923
  putMe: PutMeRequestFunction;
924
+ getUserProfile: GetUserProfileRequestFunction;
925
+ postProfileDeviceRegistration: PostProfileDeviceRegistrationRequestFunction;
926
+ putProfileDeviceRegistration: PutProfileDeviceRegistrationRequestFunction;
927
+ deleteProfileDeviceRegistration: DeleteProfileDeviceRegistrationRequestFunction;
902
928
  infoHealth: InfoHealthRequestFunction;
903
929
  infoGhost: InfoGhostRequestFunction;
904
930
  infoQuery: InfoQueryRequestFunction;
931
+ infoKagent: InfoKagentRequestFunction;
905
932
  infoTradeSummary: InfoTradeSummaryRequestFunction;
906
933
  infoCompany: InfoCompanyRequestFunction;
907
934
  infoOnboarding: InfoOnboardingRequestFunction;
@@ -1123,9 +1150,26 @@ export const requestFunctionsBuilder = (
1123
1150
  me: requestFunctionBuilder(operations.me, requestAdapter),
1124
1151
  postMe: requestFunctionBuilder(operations.postMe, requestAdapter),
1125
1152
  putMe: requestFunctionBuilder(operations.putMe, requestAdapter),
1153
+ getUserProfile: requestFunctionBuilder(
1154
+ operations.getUserProfile,
1155
+ requestAdapter
1156
+ ),
1157
+ postProfileDeviceRegistration: requestFunctionBuilder(
1158
+ operations.postProfileDeviceRegistration,
1159
+ requestAdapter
1160
+ ),
1161
+ putProfileDeviceRegistration: requestFunctionBuilder(
1162
+ operations.putProfileDeviceRegistration,
1163
+ requestAdapter
1164
+ ),
1165
+ deleteProfileDeviceRegistration: requestFunctionBuilder(
1166
+ operations.deleteProfileDeviceRegistration,
1167
+ requestAdapter
1168
+ ),
1126
1169
  infoHealth: requestFunctionBuilder(operations.infoHealth, requestAdapter),
1127
1170
  infoGhost: requestFunctionBuilder(operations.infoGhost, requestAdapter),
1128
1171
  infoQuery: requestFunctionBuilder(operations.infoQuery, requestAdapter),
1172
+ infoKagent: requestFunctionBuilder(operations.infoKagent, requestAdapter),
1129
1173
  infoTradeSummary: requestFunctionBuilder(
1130
1174
  operations.infoTradeSummary,
1131
1175
  requestAdapter
@@ -1676,6 +1720,16 @@ export const authUserServiceBuilder = (
1676
1720
  putMe: requestFunctions.putMe,
1677
1721
  });
1678
1722
 
1723
+ export const userProfileServiceBuilder = (
1724
+ requestFunctions: OperationRequestFunctionMap
1725
+ ) => ({
1726
+ getUserProfile: requestFunctions.getUserProfile,
1727
+ postProfileDeviceRegistration: requestFunctions.postProfileDeviceRegistration,
1728
+ putProfileDeviceRegistration: requestFunctions.putProfileDeviceRegistration,
1729
+ deleteProfileDeviceRegistration:
1730
+ requestFunctions.deleteProfileDeviceRegistration,
1731
+ });
1732
+
1679
1733
  export const infoHealthServiceBuilder = (
1680
1734
  requestFunctions: OperationRequestFunctionMap
1681
1735
  ) => ({
@@ -1694,6 +1748,12 @@ export const infoQueryServiceBuilder = (
1694
1748
  infoQuery: requestFunctions.infoQuery,
1695
1749
  });
1696
1750
 
1751
+ export const infoKagentServiceBuilder = (
1752
+ requestFunctions: OperationRequestFunctionMap
1753
+ ) => ({
1754
+ infoKagent: requestFunctions.infoKagent,
1755
+ });
1756
+
1697
1757
  export const tradeSummaryServiceBuilder = (
1698
1758
  requestFunctions: OperationRequestFunctionMap
1699
1759
  ) => ({
@@ -2150,9 +2210,14 @@ export interface Operations {
2150
2210
  me: typeof meOperation;
2151
2211
  postMe: typeof postMeOperation;
2152
2212
  putMe: typeof putMeOperation;
2213
+ getUserProfile: typeof getUserProfileOperation;
2214
+ postProfileDeviceRegistration: typeof postProfileDeviceRegistrationOperation;
2215
+ putProfileDeviceRegistration: typeof putProfileDeviceRegistrationOperation;
2216
+ deleteProfileDeviceRegistration: typeof deleteProfileDeviceRegistrationOperation;
2153
2217
  infoHealth: typeof infoHealthOperation;
2154
2218
  infoGhost: typeof infoGhostOperation;
2155
2219
  infoQuery: typeof infoQueryOperation;
2220
+ infoKagent: typeof infoKagentOperation;
2156
2221
  infoTradeSummary: typeof infoTradeSummaryOperation;
2157
2222
  infoCompany: typeof infoCompanyOperation;
2158
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
+ >;
@@ -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 postProfileDeviceRegistrationOperation = {
5
+ path: "/api/info/profile-device-registration",
6
+ method: "post",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.UserProfile },
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 PostProfileDeviceRegistrationRequestFunction = RequestFunction<
22
+ { body: schemas.NewDeviceRegistrationRequest },
23
+ schemas.UserProfile
24
+ >;
@@ -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 putProfileDeviceRegistrationOperation = {
5
+ path: "/api/info/profile-device-registration",
6
+ method: "put",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.UserProfile },
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 PutProfileDeviceRegistrationRequestFunction = RequestFunction<
22
+ { body: schemas.UpdateDeviceRegistrationRequest },
23
+ schemas.UserProfile
24
+ >;