@kanda-libs/ks-component-ts 0.2.391 → 0.2.393

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.2.391",
3
+ "version": "0.2.393",
4
4
  "description": "Kanda form component library",
5
5
  "main": "dist/index.esm.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,13 @@
1
+ import * as t from "io-ts";
2
+ import { Money } from "./Money";
3
+ import { Pence } from "./Pence";
4
+
5
+ export const ChargeItem = t.type({
6
+ quantity: Pence,
7
+ price: Money,
8
+ });
9
+
10
+ export interface ChargeItem {
11
+ quantity: Pence;
12
+ price: Money;
13
+ }
@@ -0,0 +1,16 @@
1
+ import * as t from "io-ts";
2
+ import { Money } from "./Money";
3
+
4
+ export const DownPayment = t.intersection([
5
+ t.type({
6
+ amount: Money,
7
+ }),
8
+ t.partial({
9
+ settled: t.union([t.literal("yes"), t.literal("no")]),
10
+ }),
11
+ ]);
12
+
13
+ export interface DownPayment {
14
+ amount: Money;
15
+ settled?: "yes" | "no";
16
+ }
@@ -0,0 +1,48 @@
1
+ import * as t from "io-ts";
2
+ import { ChargeItem } from "./ChargeItem";
3
+ import { Pence } from "./Pence";
4
+
5
+ export const EVChargerConfig = t.intersection([
6
+ t.type({
7
+ id: t.string,
8
+ charger: t.string,
9
+ charger_base_price: ChargeItem,
10
+ for_solar: t.union([t.literal("yes"), t.literal("no")]),
11
+ for_off_street_parking: t.union([t.literal("yes"), t.literal("no")]),
12
+ colour: t.string,
13
+ cable_type: t.union([
14
+ t.literal("none"),
15
+ t.literal("type_1"),
16
+ t.literal("type_2"),
17
+ ]),
18
+ fusebox_distance: t.union([
19
+ t.literal("0_to_5m"),
20
+ t.literal("6_to_15m"),
21
+ t.literal("16_to_25m"),
22
+ t.literal("over_25m"),
23
+ ]),
24
+ }),
25
+ t.partial({
26
+ colour_surcharge: ChargeItem,
27
+ cable_type_surcharge: ChargeItem,
28
+ cable_length: Pence,
29
+ cable_length_surcharge: ChargeItem,
30
+ fusebox_distance_surcharge: ChargeItem,
31
+ }),
32
+ ]);
33
+
34
+ export interface EVChargerConfig {
35
+ id: string;
36
+ charger: string;
37
+ charger_base_price: ChargeItem;
38
+ for_solar: "yes" | "no";
39
+ for_off_street_parking: "yes" | "no";
40
+ colour: string;
41
+ colour_surcharge?: ChargeItem;
42
+ cable_type: "none" | "type_1" | "type_2";
43
+ cable_type_surcharge?: ChargeItem;
44
+ cable_length?: Pence;
45
+ cable_length_surcharge?: ChargeItem;
46
+ fusebox_distance: "0_to_5m" | "6_to_15m" | "16_to_25m" | "over_25m";
47
+ fusebox_distance_surcharge?: ChargeItem;
48
+ }
@@ -0,0 +1,48 @@
1
+ import * as t from "io-ts";
2
+ import { Customer } from "./Customer";
3
+ import { DownPayment } from "./DownPayment";
4
+ import { EVChargerConfig } from "./EVChargerConfig";
5
+ import { Metadata } from "./Metadata";
6
+ import { MoneyTotal } from "./MoneyTotal";
7
+ import { Pence } from "./Pence";
8
+ import { RedirectURLs } from "./RedirectURLs";
9
+
10
+ export const Installation = t.intersection([
11
+ t.type({
12
+ customer: Customer,
13
+ configuration: EVChargerConfig,
14
+ preferred_date: t.string,
15
+ preferred_slot: t.string,
16
+ vat: Pence,
17
+ }),
18
+ t.partial({
19
+ id: t.string,
20
+ cid: t.string,
21
+ oid: t.string,
22
+ aid: t.string,
23
+ down_payment: DownPayment,
24
+ total: MoneyTotal,
25
+ redirect_urls: RedirectURLs,
26
+ xid: t.string,
27
+ xref: t.string,
28
+ metadata: Metadata,
29
+ }),
30
+ ]);
31
+
32
+ export interface Installation {
33
+ id?: string;
34
+ cid?: string;
35
+ oid?: string;
36
+ aid?: string;
37
+ customer: Customer;
38
+ configuration: EVChargerConfig;
39
+ preferred_date: string;
40
+ preferred_slot: string;
41
+ down_payment?: DownPayment;
42
+ vat: Pence;
43
+ total?: MoneyTotal;
44
+ redirect_urls?: RedirectURLs;
45
+ xid?: string;
46
+ xref?: string;
47
+ metadata?: Metadata;
48
+ }
@@ -8,6 +8,7 @@ export * from "./BankAccount";
8
8
  export * from "./Branding";
9
9
  export * from "./Cache";
10
10
  export * from "./Category";
11
+ export * from "./ChargeItem";
11
12
  export * from "./CheckoutOption";
12
13
  export * from "./CommContext";
13
14
  export * from "./CommPreferences";
@@ -25,12 +26,14 @@ export * from "./CustomerOptions";
25
26
  export * from "./DirectorInfo";
26
27
  export * from "./DirectorVerification";
27
28
  export * from "./Document";
29
+ export * from "./DownPayment";
28
30
  export * from "./EmployedDetails";
29
31
  export * from "./EmploymentDetails";
30
32
  export * from "./Enterprise";
31
33
  export * from "./EnterpriseUserRole";
32
34
  export * from "./EnterpriseUserType";
33
35
  export * from "./Error";
36
+ export * from "./EVChargerConfig";
34
37
  export * from "./Event";
35
38
  export * from "./EventOptions";
36
39
  export * from "./EventProps";
@@ -60,6 +63,7 @@ export * from "./InfoSession";
60
63
  export * from "./InfoStats";
61
64
  export * from "./InfoTrade";
62
65
  export * from "./InfoValidationEmail";
66
+ export * from "./Installation";
63
67
  export * from "./Job";
64
68
  export * from "./JobCompanyInfo";
65
69
  export * from "./JobCreditState";
@@ -0,0 +1,29 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type DeleteInstallationRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const deleteInstallationOperation = {
9
+ path: "/api/installation/{id}",
10
+ method: "delete",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Installation },
13
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
14
+ },
15
+ parameters: [
16
+ {
17
+ _tag: "FormParameter",
18
+ explode: false,
19
+ in: "path",
20
+ name: "id",
21
+ },
22
+ ],
23
+ requestDefaultHeaders: { Accept: "application/json" },
24
+ } as const;
25
+
26
+ export type DeleteInstallationRequestFunction = RequestFunction<
27
+ { params: DeleteInstallationRequestParameters },
28
+ schemas.Installation
29
+ >;
@@ -0,0 +1,29 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type GetInstallationRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const getInstallationOperation = {
9
+ path: "/api/installation/{id}",
10
+ method: "get",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Installation },
13
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
14
+ },
15
+ parameters: [
16
+ {
17
+ _tag: "FormParameter",
18
+ explode: false,
19
+ in: "path",
20
+ name: "id",
21
+ },
22
+ ],
23
+ requestDefaultHeaders: { Accept: "application/json" },
24
+ } as const;
25
+
26
+ export type GetInstallationRequestFunction = RequestFunction<
27
+ { params: GetInstallationRequestParameters },
28
+ schemas.Installation
29
+ >;
@@ -0,0 +1,25 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as t from "io-ts";
3
+ import * as parameters from "../components/parameters";
4
+ import * as schemas from "../components/schemas";
5
+
6
+ export type GetInstallationsRequestParameters = {
7
+ format?: "reduced" | "full";
8
+ q?: string;
9
+ };
10
+
11
+ export const getInstallationsOperation = {
12
+ path: "/api/installation",
13
+ method: "get",
14
+ responses: {
15
+ "200": { _tag: "JsonResponse", decoder: t.array(schemas.Installation) },
16
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
17
+ },
18
+ parameters: [parameters.format, parameters.q],
19
+ requestDefaultHeaders: { Accept: "application/json" },
20
+ } as const;
21
+
22
+ export type GetInstallationsRequestFunction = RequestFunction<
23
+ { params: GetInstallationsRequestParameters },
24
+ Array<schemas.Installation>
25
+ >;
@@ -70,6 +70,10 @@ import {
70
70
  deleteEnterpriseOperation,
71
71
  DeleteEnterpriseRequestFunction,
72
72
  } from "./deleteEnterprise";
73
+ import {
74
+ deleteInstallationOperation,
75
+ DeleteInstallationRequestFunction,
76
+ } from "./deleteInstallation";
73
77
  import { deleteJobOperation, DeleteJobRequestFunction } from "./deleteJob";
74
78
  import { deleteLeadOperation, DeleteLeadRequestFunction } from "./deleteLead";
75
79
  import {
@@ -140,6 +144,14 @@ import {
140
144
  getInfoEntityOperation,
141
145
  GetInfoEntityRequestFunction,
142
146
  } from "./getInfoEntity";
147
+ import {
148
+ getInstallationOperation,
149
+ GetInstallationRequestFunction,
150
+ } from "./getInstallation";
151
+ import {
152
+ getInstallationsOperation,
153
+ GetInstallationsRequestFunction,
154
+ } from "./getInstallations";
143
155
  import { getJobOperation, GetJobRequestFunction } from "./getJob";
144
156
  import { getJobsOperation, GetJobsRequestFunction } from "./getJobs";
145
157
  import { getLeadOperation, GetLeadRequestFunction } from "./getLead";
@@ -337,6 +349,10 @@ import {
337
349
  PostEnterpriseBranchesRequestFunction,
338
350
  } from "./postEnterpriseBranches";
339
351
  import { postEventOperation, PostEventRequestFunction } from "./postEvent";
352
+ import {
353
+ postInstallationOperation,
354
+ PostInstallationRequestFunction,
355
+ } from "./postInstallation";
340
356
  import { postJobOperation, PostJobRequestFunction } from "./postJob";
341
357
  import { postLeadOperation, PostLeadRequestFunction } from "./postLead";
342
358
  import { postMeOperation, PostMeRequestFunction } from "./postMe";
@@ -395,6 +411,10 @@ import {
395
411
  putEnterpriseOperation,
396
412
  PutEnterpriseRequestFunction,
397
413
  } from "./putEnterprise";
414
+ import {
415
+ putInstallationOperation,
416
+ PutInstallationRequestFunction,
417
+ } from "./putInstallation";
398
418
  import { putJobOperation, PutJobRequestFunction } from "./putJob";
399
419
  import { putLeadOperation, PutLeadRequestFunction } from "./putLead";
400
420
  import { putMeOperation, PutMeRequestFunction } from "./putMe";
@@ -431,9 +451,9 @@ import {
431
451
  } from "./sendLeadJob";
432
452
  import { signCreditOperation, SignCreditRequestFunction } from "./signCredit";
433
453
  import {
434
- signJobSateNoteOperation,
435
- SignJobSateNoteRequestFunction,
436
- } from "./signJobSateNote";
454
+ signJobSatNoteOperation,
455
+ SignJobSatNoteRequestFunction,
456
+ } from "./signJobSatNote";
437
457
  import { tradeLeadOperation, TradeLeadRequestFunction } from "./tradeLead";
438
458
  import {
439
459
  tradeQuoteApprovalLeadOperation,
@@ -529,7 +549,7 @@ export const operations: Operations = {
529
549
  reapplyJob: reapplyJobOperation,
530
550
  payJob: payJobOperation,
531
551
  viewJobSatNote: viewJobSatNoteOperation,
532
- signJobSateNote: signJobSateNoteOperation,
552
+ signJobSatNote: signJobSatNoteOperation,
533
553
  approveJobSatNote: approveJobSatNoteOperation,
534
554
  lenderReviewJobSatNote: lenderReviewJobSatNoteOperation,
535
555
  delayJobSatNote: delayJobSatNoteOperation,
@@ -576,6 +596,11 @@ export const operations: Operations = {
576
596
  connectTradesLead: connectTradesLeadOperation,
577
597
  acceptedJobSummaryLead: acceptedJobSummaryLeadOperation,
578
598
  referLead: referLeadOperation,
599
+ getInstallations: getInstallationsOperation,
600
+ postInstallation: postInstallationOperation,
601
+ getInstallation: getInstallationOperation,
602
+ putInstallation: putInstallationOperation,
603
+ deleteInstallation: deleteInstallationOperation,
579
604
  getSubscriptions: getSubscriptionsOperation,
580
605
  postSubscription: postSubscriptionOperation,
581
606
  getSubscription: getSubscriptionOperation,
@@ -686,7 +711,7 @@ export interface OperationRequestFunctionMap {
686
711
  reapplyJob: ReapplyJobRequestFunction;
687
712
  payJob: PayJobRequestFunction;
688
713
  viewJobSatNote: ViewJobSatNoteRequestFunction;
689
- signJobSateNote: SignJobSateNoteRequestFunction;
714
+ signJobSatNote: SignJobSatNoteRequestFunction;
690
715
  approveJobSatNote: ApproveJobSatNoteRequestFunction;
691
716
  lenderReviewJobSatNote: LenderReviewJobSatNoteRequestFunction;
692
717
  delayJobSatNote: DelayJobSatNoteRequestFunction;
@@ -733,6 +758,11 @@ export interface OperationRequestFunctionMap {
733
758
  connectTradesLead: ConnectTradesLeadRequestFunction;
734
759
  acceptedJobSummaryLead: AcceptedJobSummaryLeadRequestFunction;
735
760
  referLead: ReferLeadRequestFunction;
761
+ getInstallations: GetInstallationsRequestFunction;
762
+ postInstallation: PostInstallationRequestFunction;
763
+ getInstallation: GetInstallationRequestFunction;
764
+ putInstallation: PutInstallationRequestFunction;
765
+ deleteInstallation: DeleteInstallationRequestFunction;
736
766
  getSubscriptions: GetSubscriptionsRequestFunction;
737
767
  postSubscription: PostSubscriptionRequestFunction;
738
768
  getSubscription: GetSubscriptionRequestFunction;
@@ -956,8 +986,8 @@ export const requestFunctionsBuilder = (
956
986
  operations.viewJobSatNote,
957
987
  requestAdapter
958
988
  ),
959
- signJobSateNote: requestFunctionBuilder(
960
- operations.signJobSateNote,
989
+ signJobSatNote: requestFunctionBuilder(
990
+ operations.signJobSatNote,
961
991
  requestAdapter
962
992
  ),
963
993
  approveJobSatNote: requestFunctionBuilder(
@@ -1051,6 +1081,26 @@ export const requestFunctionsBuilder = (
1051
1081
  requestAdapter
1052
1082
  ),
1053
1083
  referLead: requestFunctionBuilder(operations.referLead, requestAdapter),
1084
+ getInstallations: requestFunctionBuilder(
1085
+ operations.getInstallations,
1086
+ requestAdapter
1087
+ ),
1088
+ postInstallation: requestFunctionBuilder(
1089
+ operations.postInstallation,
1090
+ requestAdapter
1091
+ ),
1092
+ getInstallation: requestFunctionBuilder(
1093
+ operations.getInstallation,
1094
+ requestAdapter
1095
+ ),
1096
+ putInstallation: requestFunctionBuilder(
1097
+ operations.putInstallation,
1098
+ requestAdapter
1099
+ ),
1100
+ deleteInstallation: requestFunctionBuilder(
1101
+ operations.deleteInstallation,
1102
+ requestAdapter
1103
+ ),
1054
1104
  getSubscriptions: requestFunctionBuilder(
1055
1105
  operations.getSubscriptions,
1056
1106
  requestAdapter
@@ -1189,7 +1239,7 @@ export const jobServiceBuilder = (
1189
1239
  reapplyJob: requestFunctions.reapplyJob,
1190
1240
  payJob: requestFunctions.payJob,
1191
1241
  viewJobSatNote: requestFunctions.viewJobSatNote,
1192
- signJobSateNote: requestFunctions.signJobSateNote,
1242
+ signJobSatNote: requestFunctions.signJobSatNote,
1193
1243
  approveJobSatNote: requestFunctions.approveJobSatNote,
1194
1244
  lenderReviewJobSatNote: requestFunctions.lenderReviewJobSatNote,
1195
1245
  delayJobSatNote: requestFunctions.delayJobSatNote,
@@ -1397,6 +1447,16 @@ export const leadServiceBuilder = (
1397
1447
  referLead: requestFunctions.referLead,
1398
1448
  });
1399
1449
 
1450
+ export const installationServiceBuilder = (
1451
+ requestFunctions: OperationRequestFunctionMap
1452
+ ) => ({
1453
+ getInstallations: requestFunctions.getInstallations,
1454
+ postInstallation: requestFunctions.postInstallation,
1455
+ getInstallation: requestFunctions.getInstallation,
1456
+ putInstallation: requestFunctions.putInstallation,
1457
+ deleteInstallation: requestFunctions.deleteInstallation,
1458
+ });
1459
+
1400
1460
  export const subscriptionServiceBuilder = (
1401
1461
  requestFunctions: OperationRequestFunctionMap
1402
1462
  ) => ({
@@ -1535,7 +1595,7 @@ export interface Operations {
1535
1595
  reapplyJob: typeof reapplyJobOperation;
1536
1596
  payJob: typeof payJobOperation;
1537
1597
  viewJobSatNote: typeof viewJobSatNoteOperation;
1538
- signJobSateNote: typeof signJobSateNoteOperation;
1598
+ signJobSatNote: typeof signJobSatNoteOperation;
1539
1599
  approveJobSatNote: typeof approveJobSatNoteOperation;
1540
1600
  lenderReviewJobSatNote: typeof lenderReviewJobSatNoteOperation;
1541
1601
  delayJobSatNote: typeof delayJobSatNoteOperation;
@@ -1582,6 +1642,11 @@ export interface Operations {
1582
1642
  connectTradesLead: typeof connectTradesLeadOperation;
1583
1643
  acceptedJobSummaryLead: typeof acceptedJobSummaryLeadOperation;
1584
1644
  referLead: typeof referLeadOperation;
1645
+ getInstallations: typeof getInstallationsOperation;
1646
+ postInstallation: typeof postInstallationOperation;
1647
+ getInstallation: typeof getInstallationOperation;
1648
+ putInstallation: typeof putInstallationOperation;
1649
+ deleteInstallation: typeof deleteInstallationOperation;
1585
1650
  getSubscriptions: typeof getSubscriptionsOperation;
1586
1651
  postSubscription: typeof postSubscriptionOperation;
1587
1652
  getSubscription: typeof getSubscriptionOperation;
@@ -0,0 +1,24 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export const postInstallationOperation = {
5
+ path: "/api/installation",
6
+ method: "post",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.Installation },
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 PostInstallationRequestFunction = RequestFunction<
22
+ { body: schemas.Installation },
23
+ schemas.Installation
24
+ >;
@@ -0,0 +1,35 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type PutInstallationRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const putInstallationOperation = {
9
+ path: "/api/installation/{id}",
10
+ method: "put",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Installation },
13
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
14
+ },
15
+ parameters: [
16
+ {
17
+ _tag: "FormParameter",
18
+ explode: false,
19
+ in: "path",
20
+ name: "id",
21
+ },
22
+ ],
23
+ requestDefaultHeaders: {
24
+ "Content-Type": "application/json",
25
+ Accept: "application/json",
26
+ },
27
+ body: {
28
+ _tag: "JsonBody",
29
+ },
30
+ } as const;
31
+
32
+ export type PutInstallationRequestFunction = RequestFunction<
33
+ { params: PutInstallationRequestParameters; body: schemas.Installation },
34
+ schemas.Installation
35
+ >;
@@ -1,11 +1,11 @@
1
1
  import type { RequestFunction } from "@openapi-io-ts/runtime";
2
2
  import * as schemas from "../components/schemas";
3
3
 
4
- export type SignJobSateNoteRequestParameters = {
4
+ export type SignJobSatNoteRequestParameters = {
5
5
  id: string;
6
6
  };
7
7
 
8
- export const signJobSateNoteOperation = {
8
+ export const signJobSatNoteOperation = {
9
9
  path: "/api/job/{id}/signSatNote",
10
10
  method: "post",
11
11
  responses: {
@@ -29,7 +29,7 @@ export const signJobSateNoteOperation = {
29
29
  },
30
30
  } as const;
31
31
 
32
- export type SignJobSateNoteRequestFunction = RequestFunction<
33
- { params: SignJobSateNoteRequestParameters; body: schemas.SatNote },
32
+ export type SignJobSatNoteRequestFunction = RequestFunction<
33
+ { params: SignJobSatNoteRequestParameters; body: schemas.SatNote },
34
34
  schemas.Job
35
35
  >;