@kanda-libs/ks-component-ts 0.2.196 → 0.2.197

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.196",
3
+ "version": "0.2.197",
4
4
  "description": "Kanda form component library",
5
5
  "main": "dist/index.esm.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,39 @@
1
+ import * as t from "io-ts";
2
+ import { Document } from "./Document";
3
+
4
+ export const Approval = t.intersection([
5
+ t.type({
6
+ outcome: t.union([
7
+ t.literal("PASS"),
8
+ t.literal("FAIL"),
9
+ t.literal("REVIEW"),
10
+ ]),
11
+ reason: t.union([
12
+ t.literal("approved"),
13
+ t.literal("insufficient_details"),
14
+ t.literal("invalid_details"),
15
+ t.literal("mismatched_details"),
16
+ t.literal("investigation_required"),
17
+ t.literal("not_approved"),
18
+ ]),
19
+ }),
20
+ t.partial({
21
+ reason_note: t.string,
22
+ report_raw: t.string,
23
+ report_pdf: Document,
24
+ }),
25
+ ]);
26
+
27
+ export interface Approval {
28
+ outcome: "PASS" | "FAIL" | "REVIEW";
29
+ reason:
30
+ | "approved"
31
+ | "insufficient_details"
32
+ | "invalid_details"
33
+ | "mismatched_details"
34
+ | "investigation_required"
35
+ | "not_approved";
36
+ reason_note?: string;
37
+ report_raw?: string;
38
+ report_pdf?: Document;
39
+ }
@@ -1,6 +1,7 @@
1
1
  import * as t from "io-ts";
2
2
  import { ContractAgreement } from "./ContractAgreement";
3
3
  import { Document } from "./Document";
4
+ import { OnlinePresence } from "./OnlinePresence";
4
5
  import { Pence } from "./Pence";
5
6
 
6
7
  export const CompanyInfo = t.intersection([
@@ -76,6 +77,7 @@ export const CompanyInfo = t.intersection([
76
77
  }),
77
78
  t.partial({
78
79
  trade_body_number: t.string,
80
+ online_presence: OnlinePresence,
79
81
  insurance_document: Document,
80
82
  contract_agreement: ContractAgreement,
81
83
  }),
@@ -149,6 +151,7 @@ export interface CompanyInfo {
149
151
  average_monthly_jobs: number;
150
152
  average_job_value: Pence;
151
153
  use_subcontractor: "yes" | "no";
154
+ online_presence?: OnlinePresence;
152
155
  insurance_document?: Document;
153
156
  contract_agreement?: ContractAgreement;
154
157
  }
@@ -10,6 +10,7 @@ export const Document = t.intersection([
10
10
  cid: t.string,
11
11
  oid: t.string,
12
12
  aid: t.string,
13
+ expiry: t.string,
13
14
  content: t.string,
14
15
  mimetype: t.string,
15
16
  metadata: Metadata,
@@ -22,6 +23,7 @@ export interface Document {
22
23
  oid?: string;
23
24
  aid?: string;
24
25
  name: string;
26
+ expiry?: string;
25
27
  content?: string;
26
28
  mimetype?: string;
27
29
  metadata?: Metadata;
@@ -0,0 +1,42 @@
1
+ import * as t from "io-ts";
2
+ import { Approval } from "./Approval";
3
+ import { Metadata } from "./Metadata";
4
+ import { OnboardingStage } from "./OnboardingStage";
5
+
6
+ export const Onboarding = t.partial({
7
+ id: t.string,
8
+ cid: t.string,
9
+ oid: t.string,
10
+ aid: t.string,
11
+ current_stage: OnboardingStage,
12
+ stages: t.array(OnboardingStage),
13
+ company_report_approval: Approval,
14
+ director_report_approvals: t.UnknownRecord,
15
+ consumer_report_approval: Approval,
16
+ owner_reports: t.UnknownRecord,
17
+ owner_report_approvals: t.UnknownRecord,
18
+ insurance_approval: Approval,
19
+ trade_review_approval: Approval,
20
+ online_review_approval: Approval,
21
+ fca_approval: Approval,
22
+ metadata: Metadata,
23
+ });
24
+
25
+ export interface Onboarding {
26
+ id?: string;
27
+ cid?: string;
28
+ oid?: string;
29
+ aid?: string;
30
+ current_stage?: OnboardingStage;
31
+ stages?: Array<OnboardingStage>;
32
+ company_report_approval?: Approval;
33
+ director_report_approvals?: Record<string, unknown>;
34
+ consumer_report_approval?: Approval;
35
+ owner_reports?: Record<string, unknown>;
36
+ owner_report_approvals?: Record<string, unknown>;
37
+ insurance_approval?: Approval;
38
+ trade_review_approval?: Approval;
39
+ online_review_approval?: Approval;
40
+ fca_approval?: Approval;
41
+ metadata?: Metadata;
42
+ }
@@ -0,0 +1,46 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const OnboardingStage = t.union([
4
+ t.literal("ongoing"),
5
+ t.literal("company_report_review"),
6
+ t.literal("company_report_reviewed"),
7
+ t.literal("director_report_review"),
8
+ t.literal("director_report_reviewed"),
9
+ t.literal("consumer_report_review"),
10
+ t.literal("consumer_report_reviewed"),
11
+ t.literal("owner_report_review"),
12
+ t.literal("owner_report_reviewed"),
13
+ t.literal("insurance_review"),
14
+ t.literal("insurance_reviewed"),
15
+ t.literal("trade_review"),
16
+ t.literal("trade_reviewed"),
17
+ t.literal("online_review"),
18
+ t.literal("online_reviewed"),
19
+ t.literal("fca_upload_review"),
20
+ t.literal("fca_upload_reviewed"),
21
+ t.literal("fca_awaiting_approval"),
22
+ t.literal("fca_approved"),
23
+ t.literal("onboarding_not_approved"),
24
+ ]);
25
+
26
+ export type OnboardingStage =
27
+ | "ongoing"
28
+ | "company_report_review"
29
+ | "company_report_reviewed"
30
+ | "director_report_review"
31
+ | "director_report_reviewed"
32
+ | "consumer_report_review"
33
+ | "consumer_report_reviewed"
34
+ | "owner_report_review"
35
+ | "owner_report_reviewed"
36
+ | "insurance_review"
37
+ | "insurance_reviewed"
38
+ | "trade_review"
39
+ | "trade_reviewed"
40
+ | "online_review"
41
+ | "online_reviewed"
42
+ | "fca_upload_review"
43
+ | "fca_upload_reviewed"
44
+ | "fca_awaiting_approval"
45
+ | "fca_approved"
46
+ | "onboarding_not_approved";
@@ -0,0 +1,22 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const OnlinePresence = t.intersection([
4
+ t.type({
5
+ q_online: t.union([
6
+ t.literal("Yes, I can provide the details"),
7
+ t.literal("No, I don't have this"),
8
+ ]),
9
+ }),
10
+ t.partial({
11
+ website: t.string,
12
+ facebook: t.string,
13
+ google: t.string,
14
+ }),
15
+ ]);
16
+
17
+ export interface OnlinePresence {
18
+ q_online: "Yes, I can provide the details" | "No, I don't have this";
19
+ website?: string;
20
+ facebook?: string;
21
+ google?: string;
22
+ }
@@ -2,6 +2,7 @@ export * from "./Address";
2
2
  export * from "./Analytics";
3
3
  export * from "./ApiEvent";
4
4
  export * from "./ApplicantDetails";
5
+ export * from "./Approval";
5
6
  export * from "./AuthUser";
6
7
  export * from "./BankAccount";
7
8
  export * from "./Branding";
@@ -57,6 +58,9 @@ export * from "./Money";
57
58
  export * from "./MoneyTotal";
58
59
  export * from "./Monitor";
59
60
  export * from "./NotEmployedDetails";
61
+ export * from "./Onboarding";
62
+ export * from "./OnboardingStage";
63
+ export * from "./OnlinePresence";
60
64
  export * from "./Partner";
61
65
  export * from "./Payment";
62
66
  export * from "./PaymentOption";
@@ -0,0 +1,29 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type DeleteOnboardingRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const deleteOnboardingOperation = {
9
+ path: "/api/onboarding/{id}",
10
+ method: "delete",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Onboarding },
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 DeleteOnboardingRequestFunction = RequestFunction<
27
+ { params: DeleteOnboardingRequestParameters },
28
+ schemas.Onboarding
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 GetOnboardingRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const getOnboardingOperation = {
9
+ path: "/api/onboarding/{id}",
10
+ method: "get",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Onboarding },
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 GetOnboardingRequestFunction = RequestFunction<
27
+ { params: GetOnboardingRequestParameters },
28
+ schemas.Onboarding
29
+ >;
@@ -0,0 +1,19 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as t from "io-ts";
3
+ import * as schemas from "../components/schemas";
4
+
5
+ export const getOnboardingsOperation = {
6
+ path: "/api/onboarding",
7
+ method: "get",
8
+ responses: {
9
+ "200": { _tag: "JsonResponse", decoder: t.array(schemas.Onboarding) },
10
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
11
+ },
12
+ parameters: [],
13
+ requestDefaultHeaders: { Accept: "application/json" },
14
+ } as const;
15
+
16
+ export type GetOnboardingsRequestFunction = RequestFunction<
17
+ undefined,
18
+ Array<schemas.Onboarding>
19
+ >;
@@ -46,6 +46,10 @@ import {
46
46
  deleteMonitorOperation,
47
47
  DeleteMonitorRequestFunction,
48
48
  } from "./deleteMonitor";
49
+ import {
50
+ deleteOnboardingOperation,
51
+ DeleteOnboardingRequestFunction,
52
+ } from "./deleteOnboarding";
49
53
  import {
50
54
  deletePartnerOperation,
51
55
  DeletePartnerRequestFunction,
@@ -93,6 +97,14 @@ import {
93
97
  getMonitorsOperation,
94
98
  GetMonitorsRequestFunction,
95
99
  } from "./getMonitors";
100
+ import {
101
+ getOnboardingOperation,
102
+ GetOnboardingRequestFunction,
103
+ } from "./getOnboarding";
104
+ import {
105
+ getOnboardingsOperation,
106
+ GetOnboardingsRequestFunction,
107
+ } from "./getOnboardings";
96
108
  import { getPartnerOperation, GetPartnerRequestFunction } from "./getPartner";
97
109
  import {
98
110
  getPartnersOperation,
@@ -217,6 +229,14 @@ import {
217
229
  postMonitorFlagOperation,
218
230
  PostMonitorFlagRequestFunction,
219
231
  } from "./postMonitorFlag";
232
+ import {
233
+ postOnboardingOperation,
234
+ PostOnboardingRequestFunction,
235
+ } from "./postOnboarding";
236
+ import {
237
+ postOnboardingDecisionOperation,
238
+ PostOnboardingDecisionRequestFunction,
239
+ } from "./postOnboardingDecision";
220
240
  import {
221
241
  postPartnerOperation,
222
242
  PostPartnerRequestFunction,
@@ -251,6 +271,10 @@ import {
251
271
  import { putJobOperation, PutJobRequestFunction } from "./putJob";
252
272
  import { putMeOperation, PutMeRequestFunction } from "./putMe";
253
273
  import { putMonitorOperation, PutMonitorRequestFunction } from "./putMonitor";
274
+ import {
275
+ putOnboardingOperation,
276
+ PutOnboardingRequestFunction,
277
+ } from "./putOnboarding";
254
278
  import { putPartnerOperation, PutPartnerRequestFunction } from "./putPartner";
255
279
  import { putPaymentOperation, PutPaymentRequestFunction } from "./putPayment";
256
280
  import { putRateOperation, PutRateRequestFunction } from "./putRate";
@@ -311,6 +335,12 @@ export const operations = {
311
335
  putPartner: putPartnerOperation,
312
336
  deletePartner: deletePartnerOperation,
313
337
  postPartnerReferrals: postPartnerReferralsOperation,
338
+ getOnboardings: getOnboardingsOperation,
339
+ postOnboarding: postOnboardingOperation,
340
+ getOnboarding: getOnboardingOperation,
341
+ putOnboarding: putOnboardingOperation,
342
+ deleteOnboarding: deleteOnboardingOperation,
343
+ postOnboardingDecision: postOnboardingDecisionOperation,
314
344
  getCompanies: getCompaniesOperation,
315
345
  postCompany: postCompanyOperation,
316
346
  getCompany: getCompanyOperation,
@@ -417,6 +447,12 @@ export interface OperationRequestFunctionMap {
417
447
  putPartner: PutPartnerRequestFunction;
418
448
  deletePartner: DeletePartnerRequestFunction;
419
449
  postPartnerReferrals: PostPartnerReferralsRequestFunction;
450
+ getOnboardings: GetOnboardingsRequestFunction;
451
+ postOnboarding: PostOnboardingRequestFunction;
452
+ getOnboarding: GetOnboardingRequestFunction;
453
+ putOnboarding: PutOnboardingRequestFunction;
454
+ deleteOnboarding: DeleteOnboardingRequestFunction;
455
+ postOnboardingDecision: PostOnboardingDecisionRequestFunction;
420
456
  getCompanies: GetCompaniesRequestFunction;
421
457
  postCompany: PostCompanyRequestFunction;
422
458
  getCompany: GetCompanyRequestFunction;
@@ -549,6 +585,30 @@ export const requestFunctionsBuilder = (
549
585
  operations.postPartnerReferrals,
550
586
  requestAdapter
551
587
  ),
588
+ getOnboardings: requestFunctionBuilder(
589
+ operations.getOnboardings,
590
+ requestAdapter
591
+ ),
592
+ postOnboarding: requestFunctionBuilder(
593
+ operations.postOnboarding,
594
+ requestAdapter
595
+ ),
596
+ getOnboarding: requestFunctionBuilder(
597
+ operations.getOnboarding,
598
+ requestAdapter
599
+ ),
600
+ putOnboarding: requestFunctionBuilder(
601
+ operations.putOnboarding,
602
+ requestAdapter
603
+ ),
604
+ deleteOnboarding: requestFunctionBuilder(
605
+ operations.deleteOnboarding,
606
+ requestAdapter
607
+ ),
608
+ postOnboardingDecision: requestFunctionBuilder(
609
+ operations.postOnboardingDecision,
610
+ requestAdapter
611
+ ),
552
612
  getCompanies: requestFunctionBuilder(operations.getCompanies, requestAdapter),
553
613
  postCompany: requestFunctionBuilder(operations.postCompany, requestAdapter),
554
614
  getCompany: requestFunctionBuilder(operations.getCompany, requestAdapter),
@@ -822,6 +882,17 @@ export const partnerServiceBuilder = (
822
882
  postPartnerReferrals: requestFunctions.postPartnerReferrals,
823
883
  });
824
884
 
885
+ export const onboardingServiceBuilder = (
886
+ requestFunctions: OperationRequestFunctionMap
887
+ ) => ({
888
+ getOnboardings: requestFunctions.getOnboardings,
889
+ postOnboarding: requestFunctions.postOnboarding,
890
+ getOnboarding: requestFunctions.getOnboarding,
891
+ putOnboarding: requestFunctions.putOnboarding,
892
+ deleteOnboarding: requestFunctions.deleteOnboarding,
893
+ postOnboardingDecision: requestFunctions.postOnboardingDecision,
894
+ });
895
+
825
896
  export const companyServiceBuilder = (
826
897
  requestFunctions: OperationRequestFunctionMap
827
898
  ) => ({
@@ -0,0 +1,24 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export const postOnboardingOperation = {
5
+ path: "/api/onboarding",
6
+ method: "post",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.Onboarding },
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 PostOnboardingRequestFunction = RequestFunction<
22
+ { body: schemas.Onboarding },
23
+ schemas.Onboarding
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 PostOnboardingDecisionRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const postOnboardingDecisionOperation = {
9
+ path: "/api/onboarding/{id}/decision",
10
+ method: "post",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Onboarding },
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 PostOnboardingDecisionRequestFunction = RequestFunction<
33
+ { params: PostOnboardingDecisionRequestParameters; body: schemas.Approval },
34
+ schemas.Onboarding
35
+ >;
@@ -0,0 +1,35 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type PutOnboardingRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const putOnboardingOperation = {
9
+ path: "/api/onboarding/{id}",
10
+ method: "put",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Onboarding },
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 PutOnboardingRequestFunction = RequestFunction<
33
+ { params: PutOnboardingRequestParameters; body: schemas.Onboarding },
34
+ schemas.Onboarding
35
+ >;